I am taking a C++ class and am having a problem with running my programs on my machine. When i make a simple program with dos output at school, i will get a nice auto pause at the end of the program. It usually says "Press any key to Continue..." But for some reason i do not get this on my machine. In a matter of fact, I dont get the pause while running any dos apps at all. The program will run, display and exit before I have a chance to see what has been displayed. I know i can put a simple cin to pause the program until the user hits a key, but my teacher would like me to keep that out of the final print out, and i can be quite forgetful at times.
Does anybody know how to get this message displayed without any edits to the program itself?
Page 1 of 1
Automatic pause not working in C++ "Press any key to Continue..."
#2
Posted 21 February 2004 - 03:52 AM
I don't know if its what you're looking for, but if you open the commando prompt window manually instead of running your app via Windows Explorer it doesn't close after being run ...
#3
Posted 21 February 2004 - 04:02 AM
The pause after the program runs is a feature of the IDE look for options or compile options and check whether or not it is configured to close the program after compillation.
#4
Posted 21 February 2004 - 06:07 AM
I forgot to mention that i have VC++ .Net 2003. I am creating a basic Win32 Console App. Im not able to find any options for IDE anywhere. Dont know if im just not looking hard enough or if your talking about a different version of Visual Studio all together.
I think that there is a change to make in the OS to add the pause at the end of a program just because i know that ME would pause after typing ipconfig in run, while XP just displays and closes the command window right away.
I think that there is a change to make in the OS to add the pause at the end of a program just because i know that ME would pause after typing ipconfig in run, while XP just displays and closes the command window right away.
#5
Posted 22 February 2004 - 03:51 AM
hmm u go to command prompt and pause doesn't work????
system("pause"); in c++
system("pause"); in c++
#6
Posted 25 February 2004 - 08:26 PM
at the end of your code put getch(); or getchar();
getch() is the ANSI standard, but MS changed it to getchar() in VC or VS
This will force the program to wait for a keystroke.
getch() is the ANSI standard, but MS changed it to getchar() in VC or VS
This will force the program to wait for a keystroke.
#7
Posted 25 February 2004 - 08:31 PM
oh thats right i totally forgot about that
u need to include conio.h for that
u need to include conio.h for that
- ← help by batch programming
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- good tool for progarm writing →
Share this topic:
Page 1 of 1



Help
Back to top








