title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | apiname | apilocation | apitype | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | translation.priority.ht | translation.priority.mt | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
_get_osfhandle | Microsoft Docs |
11/04/2016 |
|
article |
|
|
DLLExport |
|
|
|
0bdd728a-4fd8-410b-8c9f-01a121135196 |
14 |
corob-msft |
corob |
ghogen |
|
|
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.
File Handling
_close
_creat, _wcreat
_dup, _dup2
_open, _wopen