hi all,
i 'm working on mfc program and read text file using createfile()
Code:
CString debug;
CString myfile;
myfile = "\\D:\\text.txt";
HANDLE hFile = CreateFile(myfile.GetBuffer(10000), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
myfile.ReleaseBuffer();
if (INVALID_HANDLE_VALUE == hFile){// if setting/file not valid
DWORD dw = GetLastError ();
debug = "error";
detail.DetailValue = debug;
}else{detail.DetailValue = "open file succed";}
the file is not opened succed, and i caought the error msg: the data area passed to the system call is too small.
does anyone know this problem?
and can anyone provide succeeded way for reading file?
thanks much!