Export (0) Print
Expand All
Expand Minimize

_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.

Return Value

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

Remarks

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 ( | ).

The FCNTL.H file defines the following manifest constants:

_O_APPEND
Positions file pointer to end of file before every write operation.
_O_RDONLY
Opens file for reading only.
_O_TEXT
Opens file in text (translated) mode.

Requirements

Routine Required header Compatibility
_open_osfhandle <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

See Also

File Handling Routines | Run-Time Routines and .NET Framework Equivalents

Show:
© 2014 Microsoft