Archived

This topic is now archived and is closed to further replies.

bball2012

The window won't stay open!

Recommended Posts

bball2012    122
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.

Share this post


Link to post
Share on other sites
krez    443
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

Share this post


Link to post
Share on other sites
bball2012    122
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?

Share this post


Link to post
Share on other sites
merlin9x9    174
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.

Share this post


Link to post
Share on other sites
Drizzt DoUrden    100
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:

    

#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

Share this post


Link to post
Share on other sites