PDA

Click to See Complete Forum and Search --> : Console App Problem?


Vlatko
Sep 18th, 2000, 11:54 AM
I am making a Win32 Console Application and it works fine when i run it from VC++ but in Windows When i double click on the app, it dissapears imediately.
How Can i fix that.

Thanks!

parksie
Sep 18th, 2000, 12:26 PM
At the very end of your main() function, put:

system("pause");

You'll need to have included <stdlib.h> for this to work.
The best way, though, is to open up a command prompt and run it from there.

kb244
Sep 18th, 2000, 03:43 PM
Except I Was trying to make it pause at the end, waiting for a keystroke, I used getCh and also tried kbhit(), but in both instances, the display was blank until I pressed a key, and it would show it then immediatly exit, ( In other words, I think the console couldnt show the display fast enough, and it paused it before the console could show it, then it unpaused and showed when I pressed a key) any insight on how to do the same, or if that system("pause") will have the same behavior?

Yonatan
Sep 19th, 2000, 06:47 AM
Not that I know anything about it. :rolleyes:
But try this before the pause:

cout.flush();


This should force the Ostream to flush everything to the display.
Should.
I think.
Perhaps.
Maybe.

Try. :)