-
ms dos help
i cant find anyware better to place this so i put it here. how do u stop windows from closing a dos box. i hav some dos programs i need to run and it opens them then closes them really quick befor i can doo anything. is there a way to turn this off or am i sol?
-
Try running them from a command prompt.
Or, create a script and put a couple of pause statements in there.
-
start them from a command prompt. that is start a dos window (start>>run>>command) now navigate to the folder the game is in (c:\games\) and just type the name of the main exe. or bat file (mario)
there's really many ways to do this. give more info like the os your using what games were talking about etc
-
im on xp and into c++ and some of the things i want to try i need the box to stay open.
-
same thing man. if you start a program from within dos the dos window stays open after the program finnishes. what compiler allot of the windows compilers have an option to open a dos prompt for this purpose.
-
-
http://www.geocities.com/uniqueness_template/
Method 1 - Scaffolding:
Add the following code before any return statement in main() or any exit() or abort() statement (in any function):
/* Scaffolding code for testing purposes */
cin.ignore(256, '\n');
cout << "Press ENTER to continue..." << endl;
cin.get();
/* End Scaffolding */
This will give you a chance to view any output before the program terminates and the window closes.
Method 2 - Command-prompt:
Alternatively, instead of using Dev-C++ to invoke your program, you can just open an MS-DOS Prompt, go to the directory where your program was compiled (i.e. where you saved the project) and enter the program name (along with any parameters). The command-prompt window will not close when the program terminates.
For what it's worth, I use the command-line method.
+=+=+=+=+=+=+=+=+=+
try
system(pause)
before return
you could of course use the gcc that bloodshed bases their product on from the command line and not have to switch back and forth.
gcc -o my.exe my.cpp
-
Tedob, in my opinion, has a good method with his scaffolding code. I use something like this in my programs, though in a slightly different way. I do the following:
Code:
#include statements
#define DEBUG
function prototypes
int main()
{
blah blah
#ifdef DEBUG
/* Insert scaffolding statements here */
#endif
blah blah
}
The advantage to doing this, once you are satsified with your program and no longer need the scaffolding statements, you can simply comment out the #define DEBUG line and they will no longer appear. I use this often because I set up debugging statements throughout my programs (temporary couts of variables, memory addresses, etc.), which I may want to use again if I decide to go back and modify my program. With the #define at the top, you will never have to remove the statements or comment them all out when you don't need them anymore... you just have to comment out the one line and your set. Think of it kind of like a global constant, once it's set, it doesn't change, but you can access it as much or as little as you want.
AJ
-
thanks all that really helped
-
the only way I can think of is from as already stated[quote command prompt[/quote]
that will do the job hehe! Running from the IDE of C++ will bring U back to its IDE when code has complete running
Don't U love the power cooooodddddddding