Export (0) Print
Expand All
div
eof
Expand Minimize

_get_osfhandle 

Returns operating-system file handle associated with existing low-level file descriptor.


long _get_osfhandle( 
   int fd 
);

Parameters

fd

User file descriptor.

The _get_osfhandle function returns an operating-system file handle if fd (the low-level file descriptor) is in range and is internally marked as free. Otherwise, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, this function returns INVALID_HANDLE_VALUE (–1) and sets errno to EBADF, indicating an invalid file handle.

To close a file opened with _get_osfhandle, call _close. The underlying handle is also closed by a call to _close, so it is not necessary to call the Win32 function CloseHandle on the original handle.

Routine Required header Compatibility

_get_osfhandle

<io.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more compatibility information, see Compatibility in the Introduction.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Community Additions

ADD
Show:
© 2014 Microsoft