The CreateFile
function creates a file or directory, or opens an existing file or directory for access. It is the first function you should call to perform file I/O.
HANDLE CreateFile(
LPCTSTR lpFileName,
DWORD dwDesiredAccess,
DWORD dwShareMode,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwFlagsAndAttributes,
DWORD nFileSizeLow,
PTRULLongFileSizeLow lpFileAllocSizeLow,
PTRULLongFileSizeHigh lpFileAllocSizeHigh,
LPCWSTR lpName);
The function returns a handle to the newly created or opened file or directory, or an error code if an error occurred.
ERROR_ACCESS_DENIED
: The specified access right is not allowed for the user.ERROR_FILE_NOT_FOUND
: The specified file or directory does not exist.ERROR_PATH_NOT_FOUND
: The specified path does not exist.See the CreateFile documentation for a complete list of error codes.