_fileno
Go Up to stdio.h Index
Header File
stdio.h
Category
Input/output Routines
Prototype
int _fileno(FILE *stream);
Description
Gets the file handle.
_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.
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; }
Portability
POSIX | Win32 | ANSI C | ANSI C++ |
---|---|---|---|
+ |
+ |