Click to See Complete Forum and Search --> : Q: How to display Console Window?


April 28th, 1999, 01:44 PM
Is there an easy way to display a console window and display status messages? Is there a better way to display a small window just for the sole purpose of displaying status messages? I do not want to embed a view, edit control, or anything like that. I am looking for a system call that can be embedded into the code.

Thanks in advance

Roger Osborn
April 28th, 1999, 03:07 PM
If you have a Windows program but also want to send stuff to a Console window you can do:

#include <fstream.h>

AllocConsole();
SetConsoleTitle(_T("My Status Output"));
ofstream cstat("CONOUT$");
cstat<< "hello" << endl <<flush;

But it may not look aesthetic enough if you ship it to customers. If it's purely for your debugging you might be be better off looking at the TRACE macro or OutputDebugString function and make sure you have the output window turned on in Visual Studio when you run the program.


Cheers,
Roger