Thread overview | ||||||
---|---|---|---|---|---|---|
|
February 08, 2004 How do i pause a console program after execution? | ||||
---|---|---|---|---|
| ||||
hi, i am using Digital Mars C++ compiler for my learning purposes. can anyone tell me how to pause the programs i create after execution? coz they seem to disappear in WinXP immediately after execution. like in Blood Shed Dev C++ we can use system("PAUSE"); and in turbo c++ getch(); thanx -burner out |
February 08, 2004 Re: How do i pause a console program after execution? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burner | You need to run them from the command-line. FYI, if you want to run a command-line program from the shell, you should put it in a batch file, and call a pause function afterwards, as in: rem This batch file calls MyProg and then calls MyPause, so that it the output from MyProg remains visible in the command box MyProg MyPause as to what MyPause is, you have two options: 1. Use the Win32 "pause" utility, which waits until a key is pressed. 2. If you want it to pause for a specific time and then disappear without requiring a key press, you can use the SyPause utility from http://synesis.com.au/r_systools.html "Burner" <Burner_member@pathlink.com> wrote in message news:c05u67$1ot3$1@digitaldaemon.com... > hi, > > i am using Digital Mars C++ compiler for my learning purposes. > can anyone tell me how to pause the programs i create after execution? coz they > seem to disappear in WinXP immediately after execution. > > like in Blood Shed Dev C++ we can use system("PAUSE"); > and in turbo c++ getch(); > > thanx > > -burner out |
February 09, 2004 Re: How do i pause a console program after execution? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew <matthew.hat@stlsoft.dot.org> wrote:
> You need to run them from the command-line.
Much relief that provides when run from the IDDE debugger. The best bet
is still to invoke getchar(), fgetc(stdin), getc(stdin), etc. if running
from the IDDE debugger.
-scooter
|
February 10, 2004 Re: How do i pause a console program after execution? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burner | "Burner" wrote... > like in Blood Shed Dev C++ we can use system("PAUSE"); > and in turbo c++ getch(); If you don't mind it being specific to windows, then you could still use system("PAUSE"); (Part of #include <cstdlib> ) Otherwise, you can of course write your own pause function kinda thing ... void pause() { std::cin.clear(); std::cin.ignore(std::numeric_limits<std::streamsize>::max()); // Clear whatever's still in the buffer std::cout << "Press Enter to continue . . .\n"; std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } |
Copyright © 1999-2021 by the D Language Foundation