fileno
(3)obtain file descriptor of a stdio stream
#include <stdio.h> int fileno(FILE *stream); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): fileno(): _POSIX_C_SOURCE
LIBRARY
DESCRIPTION
The function fileno() examines the argument stream and returns the integer file descriptor used to implement this stream. The file descriptor is still owned by stream and will be closed when fclose(3) is called. Duplicate the file descriptor with dup(2) before passing it to code that might close it.
For the nonlocking counterpart, see unlocked_stdio(3).
RETURN VALUE
ERRORS
- EBADF
- stream is not associated with a file.