CreateFile

Purpose

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.

Parameters

                    
                        HANDLE CreateFile(
                            LPCTSTR lpFileName,
                            DWORD dwDesiredAccess,
                            DWORD dwShareMode,
                            LPSECURITY_ATTRIBUTES lpSecurityAttributes,
                            DWORD dwFlagsAndAttributes,
                            DWORD nFileSizeLow,
                            PTRULLongFileSizeLow lpFileAllocSizeLow,
                            PTRULLongFileSizeHigh lpFileAllocSizeHigh,
                            LPCWSTR lpName);
                    
                

Return Value

The function returns a handle to the newly created or opened file or directory, or an error code if an error occurred.

Error Codes

See the CreateFile documentation for a complete list of error codes.