User forums > Using Code::Blocks
system("pause") command
azrael2000:
Hi All.
Just a little question.
While developing, I normally use the command
--- Code: ---system("Pause");
--- End code ---
in C++ to stop the console window so I can see what is in it.
I have tried this command in Code::Blocks and it fails.
Do I have to load a .h file? In other programs I have used this has never been an issue.
I am running windows 7 OS
Regards
Jenna:
The first thing:
C::B is an IDE not a compiler, it can work with many compilers.
If you use a project (recommended), you should go to "Project -> Properties -> Build targets", make sure your target is of type "Console project" and you have checked "Pause when execution ends".
xunxun:
The standard doesn't contain "system", and it's not portable.
You can try to use "cin.get()" to pause the execution.
azrael2000:
Hi there.
Thank you for the response.
I checked where you suggested, and I do have the check box checked.
However, the console window still just quickly flashes when the compiled program (debug or release) runs and then is no more.
I've been using the gcc compiler with the program.
Regards
Jenna:
--- Quote from: azrael2000 on November 18, 2010, 06:42:31 pm ---Hi there.
Thank you for the response.
I checked where you suggested, and I do have the check box checked.
However, the console window still just quickly flashes when the compiled program (debug or release) runs and then is no more.
I've been using the gcc compiler with the program.
Regards
--- End quote ---
It works only, if you start your program from inside C::B with the green triangle or via "Build -> Run" (Ctrl + F10) or "Build -> Build and run" (F9), not if you use the debugger and not if you run it from outside C::B.
Navigation
[0] Message Index
[#] Next page
Go to full version