Low-Level I/O


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

These functions invoke the operating system directly for lower-level operation than that provided by stream I/O. Low-level input and output calls do not buffer or format data.

Low-level routines can access the standard streams opened at program startup using the following predefined file descriptors.

StreamFile Descriptor

Low-level I/O routines set the errno global variable when an error occurs. You must include STDIO.H when you use low-level functions only if your program requires a constant that is defined in STDIO.H, such as the end-of-file indicator (EOF).

Low-Level I/O Functions

_closeClose file
_commitFlush file to disk
_creat, _wcreatCreate file
_dupReturn next available file descriptor for given file
_dup2Create second descriptor for given file
_eofTest for end of file
_lseek, _lseeki64Reposition file pointer to given location
_open, _wopenOpen file
_readRead data from file
_sopen, _wsopen, _sopen_s, _wsopen_sOpen file for file sharing
_tell, _telli64Get current file-pointer position
_umask, _umask_sSet file-permission mask
_writeWrite data to file

_dup and _dup2 are typically used to associate the predefined file descriptors with different files.

Input and Output
Run-Time Routines by Category
System Calls