View Full Version : Dos window Noobie question
dragonx7
09-20-2004, 02:56 AM
Hi guys,
I am having trouble keeping my command window up. I decided to try to use Miracle C to help make the coding less tedious and it works allright, except every time I go to run the program the dos window pops up and when the program is done running the window terminates so I cant see the output. I have already tried clearing the "Close on exit" box in the properties screen of command.com and now dont know what to do. Any help would be appreciated.
phrygius
09-20-2004, 03:45 AM
You have to actually run it from the command prompt to keep the window open after it finishes running
dragonx7
09-20-2004, 04:18 AM
I saw that coming. I guess I thought I could have the command window come up and run the program when I needed it to and after it was finished running keep the window up to check my results. That would be too easy though. :crash:
sicarius
09-22-2004, 06:36 PM
if you include the C++ header file: stdio.h, you should be able to add the following to your program (near the end of execution) so as to keep the window open.
getc();
This function will wait until it can take one character from the standard input stream. That is, after pressing any key it should return.
Houdini
11-13-2004, 03:07 PM
Well it depends on what language the guy is using Perl, C++, and many other languages or scripts will run in a DOS Window and exit after completing, Windows XP will keep the DOS window open and show much more. I Use PERL and am just starting to use C++ but after having a couple of hard drive crashes and os system failures (probably my fault) It would help if he told what he was using to achieve that same problem with another system.
Whiteknight
11-15-2004, 12:38 PM
my personal favorite method is to include the <stdlib.h> file, and do a call to
system("pause");
which brings up a nice "Press any key to continue..." notice. This only works on windows though, (but then again, that was specified in the question.)
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.