[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.6 freem_get()

Retrieves a FreeM local node, global node, or writable SSV node.

Synopsis

short freem_get(freem_ref_t *ref);

Parameters

freem_ref_t

This parameter is a pointer to a freem_ref_t struct. The caller must allocate the memory for this struct.

Return Value

Returns OK on success, or one of the other error values defined in merr.h.

Example

This example retrieves the character set of the current process.

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <freem.h>

int main(int argc, char **argv, char)
{
    pid_t pid;
    freem_ref_t ref;

    /* get the PID of this process */
    pid = getpid();

    /* we want to access an SSV */
    ref.reftype = MREF_RT_SSV;
    
    /* set up the name and subscripts */
    strcpy(ref.name, "JOB");

    ref.subscript_count = 2;
    sprintf(ref.subscripts[0], "%d", pid);
    strcpy(ref.subscripts[1], "CHARACTER");

    /* initialize libfreem, using the USER namespace */
    freem_init("USER");

    /* call libfreem API */
    freem_get(&ref);

    /* output the character set info */
    printf("PID %d character set is '%s'\n", pid, ref.value);
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on October 14, 2020 using texi2html 1.82.