Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program runs, but DOS window disappears......

Status
Not open for further replies.

amandanelson

Programmer
Sep 30, 2002
2
GB
Hi All,
I wonder if you can help, i'm a new user. I've typed in my program, and it's compiled, when i go to run the program, i can type in the inputs but the command line prompt won't stay longer than a second to be able to see the results. Does anyone have any idea why this is happening, is there a similar command to the 'writeln' in Pascal to stop this happening.

Thanks in advance to anyone who can help.

Amanda
 
By default, the DOS screen closes when it is finished. An easy get-around to this is to have the program wait for input before the end of the program. For example, if you are using streams you could do something like:
Code:
char c;
cin >> c;
return 0; // The final return for the MAIN function.

Or you could change the settings for you Window's DOS screens that make them wait for you to manuallt close them. James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
I also forgot to mention getch.
James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top