fileno
raw OCR
Gets file handle.
Defined in header <stdio.h>
Syntax
#include <stdio.h>
int fileno(FILE *stream);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ |
Remarks
fileno is a macro that returns the file handle for the given stream. If stream has more than one handle, fileno returns the handle assigned to the stream when it was first opened.
Return value
fileno returns the integer file handle associated with stream.
See also
Example
#include <stdio.h>
int main(void)
{
FILE *stream;
int handle;
/* create a file */
stream = fopen( "DUMMY.FIL", "w");
/* obtain the file handle associated with the stream */
handle = fileno (stream);
/* display the handle number */
printf ("handle number: %d\n", handle);
/* close the file */
fclose (stream);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/stdio.h/fileno/
· short form /3.1/fileno/