Pause at the end of Command Line Scripts?
Members - Reputation: 181
Posted 28 August 2012 - 06:05 PM
Crossbones+ - Reputation: 3518
Posted 28 August 2012 - 07:19 PM
Of course, if you want to avoid this, you can always run the script from the command-line itself (i.e. start the command-line interpreter, cd to your program and run it), this way the program will run "inside" the command-line interpreter and won't close the console once finished. It might be a bit harder to set up but it's generally the best way to do it, as waiting for user input to terminate the program isn't very script-friendly, especially for long-running scripts. You do have to deal with the CLI awkwardness but overall it works better except for throwaway programs (where just waiting for a keypress is faster to whip up and more convenient).
So instead of:
You would get:
Copyright Windows blablabla
>> cd C:\some\path\to\my\program\
Does it make sense?
Members - Reputation: 103
Posted 29 August 2012 - 11:49 AM
using namespace std;
cout << "Hey, I'm paused!" << endl;
//program pauses an user is prompted to hit any key to continue
Members - Reputation: 121
Posted 31 August 2012 - 06:13 PM
Free C++, OpenGL, and Game Development Video Tutorials @
Play my free games: Ghost Toast, Zing