NAME

stdin_init - open stdin standart stream file

stdin_close - close stdin standart stream file

get_stdin_ptr - get current stdin standart stream file pointer

stdout_init - open stdout standart stream file

stdout_close - close stdout standart stream file

get_stdout_ptr - get current stdout standart stream file pointer

SYNOPSIS

#include <stdio.h>

FILE * stdin_init (char *fildes);
FILE * get_stdin_ptr(void);
void stdin_close (void);
FILE * stdout_init (char *fildes);
FILE * get_stdout_ptr(void);
void stdout_close (void);

DESCRIPTION

A file with associated buffering is called a stream and is declared to be a pointer to a defined type FILE. The fopen() function creates certain descriptive data for a stream and return a pointer to designate the stream in all further transactions.

Normally, on a standard LINUX/UNIX system, there are three open streams with constant pointers declared in the <stdio.h> header and associated with the standard open files.

Under Unison, these predefined streams are platform specific and implemented (or not) by the target hardware. As such, these streams require definition. These functions are provided (normally, for use with the user defined posix_compat function pair) to allow STDIO library functions such as printf() and application code using them to operate as expected.

RETURN VALUES

On success functions return a pointer to the opened stream file; otherwise, null.

ERRORS

No errors are defined.

EXAMPLE

int posix_compat(char *cwd, char *stdinServerName, char *stdoutServerName)
{

/* any other init functions */

stdout_init (stdoutServerName);

stdin_init (stdinServerName);

/* any other init functions */

return 1;
}

int end_posix_compat()
{

stdout_close();

stdin_close();

return 1;
}

void main ()
{

/* any other init functions */

posix_compat("", "/dev/ttyS1", "/dev/ttyS1");

/* any other functions */

// close stdin, stdout stream files

end_posix_compat();
}

SEE ALSO

fclose(), fopen(), printf(), posix_compat()


< Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2011 >