The window won't stay open!
In my C++ program, how am I suppose to get the DOS window to stay open. The start of the program runs fine, but when I press enter the window disappears. I''m sure someone''s already asked this question, but I''d really appreciate some help.
quote: Original post by bball2012
I'm sure someone's already asked this question, but I'd really appreciate some help.
well, i can't control your mouse from here, so you'll have to click this link yourself...
--- krez (krezisback@aol.com)
Edited by - krez on January 30, 2002 8:41:01 PM
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Just add the following at the end of your main() function:
system ("PAUSE");
You''ll need to include "stdlib.h" as well I think.
-Goku
SANE Productions Homepage
system ("PAUSE");
You''ll need to include "stdlib.h" as well I think.
-Goku
SANE Productions Homepage
This question should be in the FAQ, surrounded by signs and blinking lights ...
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
I tried putting in the system("PAUSE") thing, but my compiler just said
"implicit declaration of function int system(...)''
Does anyone know what this means?
"implicit declaration of function int system(...)''
Does anyone know what this means?
It''s not DOS. DOS is an operating system. What you see is the Console. The Console is a subsystem of Win32, just as is the GUI. The only way you''d get DOS anything from your app is if it were a DOS app. But I guarantee that it is a Win32 PE executable, therefore it cannot have anything to do with DOS by definition. A nitpicky thing, yes, but it''s good to be precise.
Basically you just need to make a loop, and get user input. When the user inputs that they are done, the loop will not continue and the window will close.
Here's an example:
If you run that small piece of code, the window will not close untill you input a 1 (when prompted).
Hope that helped.
------------------------------
Simple DirectMedia Layer:
Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net's Tutorials - (Here)
OpenGL:
Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)
Edited by - Drizzt DoUrden on February 2, 2002 11:45:30 PM
Here's an example:
#include <iostream.h>int main(){ int done = 0; while(done == 0) { cout << "Quit? 1 = Yes, 0 = No.\n"; cin >> done; }return 0;}
If you run that small piece of code, the window will not close untill you input a 1 (when prompted).
Hope that helped.
------------------------------
Simple DirectMedia Layer:
Main Site - (www.libsdl.org)
Cone3D Tutorials- (cone3D.gamedev.net)
GameDev.net's Tutorials - (Here)
OpenGL:
Main Site - (www.opengl.org)
NeHe Tutorials - (nehe.gamedev.net)
Online Books - (Red Book) (Blue Book)
Edited by - Drizzt DoUrden on February 2, 2002 11:45:30 PM
------------------------------Put THAT in your smoke and pipe it
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement