Export (0) Print
Expand All
div
eof
Expand Minimize
1 out of 2 rated this helpful - Rate this topic

_open_osfhandle 

Associates a C run-time file descriptor with an existing operating-system file handle.


int _open_osfhandle (
   intptr_t osfhandle,
      int flags 
);

Parameters

osfhandle

Operating-system file handle.

flags

Types of operations allowed.

If successful, _open_osfhandle returns a C run-time file descriptor. Otherwise, it returns –1.

The _open_osfhandle function allocates a C run-time file descriptor and associates it with the operating-system file handle specified by osfhandle. The flags argument is an integer expression formed from one or more of the manifest constants defined in Fcntl.h. When two or more manifest constants are used to form the flags argument, the constants are combined with the bitwise-OR operator ( | ).

Fcntl.h defines the following manifest constants.

_O_APPEND

Positions a file pointer to the end of the file before every write operation.

_O_RDONLY

Opens the file for reading only.

_O_TEXT

Opens the file in text (translated) mode.

To close a file opened with _open_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

_open_osfhandle

<io.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium 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.

Libraries

All versions of the C run-time libraries.

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

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.