_get_osfhandle

Gets operating-system file handle associated with existing stream FILE pointer.

long _get_osfhandle( int filehandle );

Routine Required Header Compatibility
_get_osfhandle <io.h> Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

If successful, _get_osfhandle returns an operating-system file handle corresponding to filehandle. Otherwise, it returns –1 and sets errno to EBADF, indicating an invalid file handle.

Parameter

filehandle

User file handle

Remarks

The _get_osfhandle function returns filehandle if it is in range and if it is internally marked as free.

File Handling Routines

See Also   _close, _creat, _dup, _open