fileno(3S)
NAME
fileno(), fileno_unlocked() − map stream pointer to file descriptor
SYNOPSIS
#include <stdio.h>
int fileno(FILE *stream);
int fileno_unlocked(FILE *stream);
DESCRIPTION
fileno() returns the integer file descriptor associated with the named stream; see open(2).
The following symbolic values in <unistd.h> define the file descriptors associated with stdin, stdout, and stderr when a program is started :
STDIN_FILENO Value of zero for standard input, stdin.
STDOUT_FILENO Value of 1 for standard output, stdout.
STDERR_FILENO Value of 2 for standard error, stderr.
fileno_unlocked is identical to fileno except it does not perform any internal locking of the stream for multi-thread applications. fileno_unlocked can be used by multi-thread applications which have already used flockfile() to acquire a mutual exclusion lock for the stream (see flockfile(3S)).
RETURN VALUE
Upon error, fileno() and fileno_unlocked() return −1.
SEE ALSO
open(2), flockfile(3S), fopen(3S).
STANDARDS CONFORMANCE
fileno(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
Hewlett-Packard Company — HP-UX Release 10.20: July 1996