Large Data File Processing Method Based on MFC

Source: Internet
Author: User

 

 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.