If possible, what is the best way to write to standard output (or standard error) from a VS C++ MFC Windows Application I want to be able to print a a few lines of text to standard output when the application is exiting. This would be useful when the application is invoked from the DOS Command prompt and the application outputs a few lines of text that could be viewed in the command prompt window (or redirected to a text log file).

MFC Application and stdout
CyTom
Lao K
Nobody likes to make definitive statements about performance because it's not an exact science and often based on assumptions out of our know. But you don't have anything to worry about in terms of resource consumption by changing the subsystem type in this way.
(Besides, any possible difference in perf is overwhelmed by the fact you're using MFC.)
Brian
Phizz
1. Change the linker subsystem type to /SUBSYSTEM:CONSOLE (linker->system->subsystem)
2. Override the entry point to what it was before: wWinMainCRTStartup. (linker->advanced->entry point)
3. Create a new cpp file with:
#include "stdafx.h"
void MyWriteConsole( CString& str )
{
fwprintf( stdout, str.GetString() );
}
4. Add the prototype extern void MyWriteConsole( CString& str ); at the end of stdafx.h.