Click to See Complete Forum and Search --> : exe qerks


flutie98
10-02-2003, 02:10 PM
ok im using microsoft visual c++ 5.0 as my compiler
whenever i run my progs through the compiler they work but when i just run the exe from a windows whenever the thing that is supposed to do is done the dos window then just goes away, is there any command or way of making the msdos window stay up till a key is pressed or something along those lines

rock
10-02-2003, 02:39 PM
Alternatively, you could open a DOS session (command prompt), change to the directory where your exe is and run it directly. By definition, console applications should run from the console.

Big_Mac
10-02-2003, 09:31 PM
at the very beginning of your program: #include <stdio.h>
at the very end of your main: getchar();

the program will pause at the last line there until it gets a character from the standard input stream.

it's as easy as that.

flutie98
10-03-2003, 01:12 AM
Originally posted by Big_Mac
at the very beginning of your program: #include <stdio.h>
at the very end of your main: getchar();

the program will pause at the last line there until it gets a character from the standard input stream.

it's as easy as that.

thank you