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!
Printable View
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!
At the very end of your main() function, put:
You'll need to have included <stdlib.h> for this to work.Code:system("pause");
The best way, though, is to open up a command prompt and run it from there.
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?
Not that I know anything about it. :rolleyes:
But try this before the pause:
This should force the Ostream to flush everything to the display.Code:cout.flush();
Should.
I think.
Perhaps.
Maybe.
Try. :)