Export (0) Print
Expand All
div
eof
Expand Minimize
This topic has not yet been rated - Rate this topic

_get_osfhandle

Updated: March 2011

Retrieves the operating-system file handle that is associated with the specified file descriptor.

intptr_t _get_osfhandle( 
   int fd 
);
fd

An existing file descriptor.

An operating-system file handle if fd is valid. 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

_get_osfhandle

<io.h>

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.

Date

History

Reason

March 2011

Updated the return value type to intptr_t, which is a type whose size is platform specific. Clarified the wording in the summary and parameter sections.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.