InVisual C++,MFC(Microsoft basic class library) providesCFileAndCStdioFileThese two classes are used to input and output files in the program.CfileClass provides file operations based on binary streams, the function is similarCLanguageFread() AndFwrite() Function.CStdioFileProvides File Operations Based on string streams. The function is similarCLanguageFgets() AndFputs() Function. However, when these two classes are used for file operations, the size of the data volume read and written to a file must be limited65535Within bytes. The reason is thatVCMedium Access is greater65535Bytes buffer requiredHugeType pointer, whileCFileAndCStdioFileClass, which isFarType pointer. BecauseFarType pointers do not have cross-segment addressing capabilities, so the length of a single file read/write is limited to less65535Bytes. IfCFileAndCStdioFileThe data buffer size of the member functions of the two classes is greater65535In bytes,VCIt will generateASSERTError.
I am usingVisual C++ When designing a multimedia program, because the data volume processed by the program is very large, it is necessary to read and write more frequently65535Bytes of data. In useCFileAndCStdioFileClass is generally used to process massive data through multipart read/write. I feel that this processing method is very complicated and may cause programming errors. After reading the relevant documents, I foundVisual C++ Directly reads and writes massive data.
InMFCOfCFileClass provides two functions that are not loaded into the document. Its prototype declaration is in
AFX.H. The function prototype is as follows:
DWORD CFile::ReadHuge(Void FAR*LpBuffer,DWORD dwCo
Unt);
Void CFile