
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - fileno
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
fileno
Usage
#include <stdio.h>
int fileno(FILE *fp);
Description
fileno returns the file descriptor associated with stream fp. This is
the same as the DOS file handle. The fp argument must point to a file
which is already open.
The fileno function converts a file pointer to a file descriptor for
use with the low-level file functions such as close, read and write.
Mixing of high and low level functions is not normally recommended.
Example
#include <stdio.h>
main()
{
int fd;
fd = fileno(stderr);
printf("The file handle for stderr is %d\n",fd);
fd = fileno(stdaux);
printf("The file handle for stdaux is %d\n",fd);
fd = fileno(stdprn);
printf("The file handle for stdprn is %d\n",fd);
}
Return Value
fileno returns the file descriptor. There is no error return.
See Also: fopen freopen
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson