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
#include <stdio.h>
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.
On success functions return a pointer to the opened stream file; otherwise, null.
No errors are defined.
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();
}
fclose(), fopen(), printf(), posix_compat()