Output and input from console window?

  • Thread starter Thread starter Teis Draiby
  • Start date Start date
T

Teis Draiby

I am working on a Win32 program with an additional console window to output
messages. I also want to type commands in the console window. Is there any
common way to achieve that?
For example how do I output messages while the console is listning for
command inputs?

I'm looking forward for your answer with great anticipation
 
Teis said:
I am working on a Win32 program with an additional console window to
output messages. I also want to type commands in the console window.
Is there any common way to achieve that?

Of course - just like you would with a pure console program. See

http://support.microsoft.com/default.aspx?scid=kb;en-us;105305

for information on how to connect a console to stdin and stdout from within
a GUI program.
For example how do I output messages while the console is listning for
command inputs?

If you want to both wait for input and write output you need to use multiple
threads - one for reading and one for writing. If your GUI is writing to
the console (debug log messages, for example), you probably want to create
another dedicated thread that does the console input and processes the
command that you enter.

-cd
 
Back
Top