Re:What's the difference between the com and exe extensions?...
by to3m on Saturday May 27, 2017 @04:55PM
(#14431933)
Best solution I've found:
static void PressEnter(void) {
if(IsDebuggerPresent()) {
fprintf(stderr,"press enter\n");
getchar();
}
}
Then from somewhere right near the top of main or whatever: atexit(&PressEnter);
You can throw in some isatty calls, or #ifdef _CONSOLE, or if(GetConsoleWindow()), etc., but the above pretty much always does the right thing.
Re:What's the difference between the com and exe extensions?...
by int_19h on Sunday May 28, 2017 @01:22AM
(#14433188)
Or you can flip the switch in the IDE itself to pause on exit.
Re:What's the difference between the com and exe extensions?...
by to3m on Sunday May 28, 2017 @07:42PM
(#14436594)
Does Visual Studio have such an option? If so, where is it?
And till this day, people writing command-line programs in an IDE like Visual Studio stumble on this fact, and the workaround is still the same: adding an stdin read or something like system("PAUSE") at the end, pausing the execution until the user hits Enter.