FILENO - find file descriptor number of file.

(Compatible with UNIX System V C)


#include <fildes.h>
fd = fileno( f );


FILE *f;
points to the file whose descriptor number is to be obtained.
int fd;
is the file descriptor number of the file.


"fileno" returns the file descriptor number of the indicated file. "stdin", "stdout", and "stderr" have stream numbers 0, 1, and 2 respectively. Other files have stream numbers between 3 and 19.

"fileno" returns a -1 in case of error (e.g. the file is not open).

See Also:

expl c lib open

expl c include fildes

Copyright © 1996, Thinkage Ltd.