The _lcreat function creates or opens a specified file. This function is provided for compatibility with 16-bit versions of Windows. Win32-based applications should use the CreateFile function.
HFILE _lcreat(
LPCSTR lpPathName, |
// pointer to name of file to open |
int iAttribute |
// file attribute |
); |
Value |
Meaning |
0 |
Normal (can be read from or written to without restriction). |
1 |
Read only (cannot be opened for write) |
2 |
Hidden (not found by directory search) |
4 |
System (not found by directory search) |
If the function succeeds, the return value is a file handle.
If the function fails, the return value is HFILE_ERROR. To get extended error information, call GetLastError.
If the file does not exist, the _lcreat function creates a new file and opens it for writing. If the file exists, _lcreat truncates the file size to zero and opens it for reading and writing. When the function opens the file, the pointer is set to the beginning of the file.
The _lcreat function should be used carefully. It can open any file, even one already opened by another function.
See: