I just started working on a small tool to search for (heavy) text files using Visual
C++ with MFC.
Because there are a lot of readings, I'm wondering if ifstream of the standard
library is better than CFile of MFC?
I don't need portability (the program is for Windows Environment), so I don't see
any advantages of ifstream over CFile? However, with little experience with MFC I'm not
certain if the performance of CFile is better or worse than ifstream? I doubt that replacing CFile with ifstream will do much in terms of performance improvement but I still want to ask you guys' opinions on this.

Thank you very much

Depends on the file and its contents. CFile is not a good choice for reading strings (standard text files) unless you also want to use CArchive and CString. If you don't have to serialize MFC classes then I would use standard c++ fstream

Thank you very much!
I replaced CFile with ifstream and indeed the performance is significantly improved (about 15% search time is saved).

Well, Microsoft should've mentioned the performance difference in their documentation lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.