I'm finding that using ifstream to read in numbers from a text file runs slow in MFC applications (vc++ 6.0). This seems to be related to MFC applications being multi-threaded.
In a console application without MFC, the following code
ifstream in("test.txt");
double x;
while(!in.eof()) {
in >> x;
}
in.close();
runs 3-4 times slower when Project Settings - Code Generation "use run-time library" is Multi-threaded compared to single-threaded.
Doing the same using C functions fopen and fscanf is unaffected by these options and faster than ifstream.
Does any one know how to get around the poor ifstream performance in MFC / multi-threaded applications
James.

ifstream performance
Joakim Larsson
1. VC 6 is no longer supported!
2. There is a bug in MSVC6's library that causes buffering to be needlessly disabled for files opened by name. See the section here:
www.dinkumware.com/vc_fixes.html
3. You can also fix it by upgrading to VC 7 (or better, 7.1, or much better 8.0) or buy the upgrade VC6 library from www.dinkumware.com