BOOL Open( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL );//打开文件
Parameters
lpszFileName
A string that is the path to the desired file. The path can be relative, absolute, or a network name (UNC).
nOpenFlags
A UINT that defines the file’s sharing and access mode. It specifies the action to take when opening the file. You can combine options by using the bitwise-OR ( | ) operator. One access permission and one share option are required; the modeCreate and modeNoInherit modes are optional. See the CFile constructor for a list of mode options.
pError
A pointer to an existing file-exception object that will receive the status of a failed operation.
LONG CFile::Seek( LONG lOff, UINT nFrom );//设置指针位置
Parameters
lOff
Number of bytes to move the pointer.
nFrom
Pointer movement mode. Must be one of the following values:
CFile::begin Move the file pointer lOff bytes forward from the beginning of the file.
CFile::current Move the file pointer lOff bytes from the current position in the file.
CFile::end Move the file pointer lOff bytes from the end of the file. Note that lOff must be negative to seek into the existing file; positive values will seek past the end of the file.
void CFile::Write( const void* lpBuf, UINT nCount );//写数据
Parameters
lpBuf
A pointer to the user-supplied buffer that contains the data to be written to the file.
nCount
The number of bytes to be transferred from the buffer. For text-mode files, carriage return?linefeed pairs are counted as single characters.