Guardian C Library Calls Reference Manual
fopen_std_file (supplementary)
3-50 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
Example
This example opens a file named $a.b.c for update (reading and writing):
#include <stdioh>
FILE *fp;
fp = fopen("$a.b.c", "r+");
fopen_std_file (supplementary)
The fopen_std_file function opens a standard file stdin, stdout, or stderr if the file was
not opened automatically because the NOSTDFILES pragma was specified or because
the main function was not written in the C language.
file
is an integer that specifies which standard file should be opened: 0 indicates stdin, 1
indicates stdout, and 2 indicates stderr.
die_on_error
is a boolean flag that when nonzero indicates that if there is an error in attempting to
open the file the normal shutdown sequence should be executed, which includes
writing a standard message, and then calling the system procedure
PROCESS_STOP_
Return Value
indicates the status of the operation. The function returns 0 if the open is successful,
1 if the file is already open, -1 if there is a problem with a parameter, and -2 if the
open failed. The -2 is not returned if nonzero was passed for the die_on_error
parameter.
#include <stdioh>
short fopen_std_file(short file, short die_on_error);