Article ID: 11988 - Last Review: October 30, 2003 - Revision: 3.0 Windows File I/O vs. C Run-time File I/OThis article was previously published under Q11988 SUMMARY
The following functions are provided by the Microsoft C Run-time Library
(CRT) and the Windows API to create a file:
Return Type API or Function Category -------------------------------------------- HFILE OpenFile Windows API HFILE _lopen/_lcreat Windows API int _open/_creat CRT FILE * fopen CRT For files opened with OpenFile(), _lopen, and _lcreat, the common file manipuluation routines that you should use are:
_lclose
For files opened with _open() and _creat(), the common file manipulation
routines that you should use are:
_llseek _lread _lwrite
_close
For files opened with fopen, the common file manipulation routines that you
should use are:
_lseek _read _write
fclose
For other input and output functions, please check the documentation for
information on whether they are intended for use with MS-DOS handles
(HFILE), streams (FILE *), or low-level I/O (int).
fseek fread fwrite MORE INFORMATION
An application should use the OpenFile() API any time an MS-DOS file handle
is required.
The open functions do not necessarily open a file in binary raw mode; the application is required to set the binary attribute explicitly. The OpenFile() function automatically performs this step. If the filename parameter specifies only a filename and extension, the open functions search for a matching file only in the current directory. In Windows, the OpenFile() API creates an MS-DOS file handle through which an application can access Windows-specific files. OpenFile() initially opens the file in binary raw mode by performing an MS-DOS Interrupt 21h Function 3Dh. If the lpFileName parameter specifies only a filename and an extension, OpenFile() searches for a matching file in the following directories:
APPLIES TO
| Article Translations
|

Back to the top
