//the block size DWORD dwBlockBytes=0; For (int I=1; ; + + I) { If (qwFileSize & lt;=I * dwGran) { DwBlockBytes=I * dwGran; break; } } If (qwFileOffset & gt;=0) { //map view //if the call MapViewOfFile (), if dwNumberOfBytesToMap is greater than the file size, then the call will fail, //and the error code is access denied, so the last parameter MapViewOfFile cannot use dwBlockSize and can only use qwFileSize, //MapViewOfFile return values can't be a TCHAR *, for UNICODE interpreted as wide character, will go wrong, can only use char * Char * lpbMapAddress=(char *) MapViewOfFile (hFileMap FILE_MAP_READ, 0, 0, qwFileSize); If (lpbMapAddress==NULL) { The CloseHandle (hFileMap); The CloseHandle (hFile); return; }
///read the file content
}
To ask you, how specific to read the contents of the file, binary file, content contains a double, int type data such as???????
CodePudding user response:
LpbMapAddress is the file content, similar to a memory data But the binary file only if you understand the file structure (such as structure), otherwise it's just a piece of data
CodePudding user response:
Binary read directly to the array and the need to parse corresponding field back to other data
CodePudding user response:
You don't have a char * lpbMapAddress? Is this the file content?