Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-45
fileno (supplementary)
fileno (supplementary)
The fileno function retrieves the file descriptor of a file opened for ANSI I/O.
stream
denotes a file opened for ANSI I/O.
Return Value
is the file descriptor if *stream refers to an open file; otherwise, fileno returns the
value -1.
Example
This example illustrates how fileno returns the file descriptor of a file opened for
ANSI I/O:
#include <stdioh>
FILE *f_ptr;
int f_desc;
f_ptr = fopen("$a.b.c", "r+");
/* ... */
f_desc = fileno(f_ptr);
#include <stdioh>
int fileno(FILE *stream);