Hi there,
i'm very new to programming in C (new to programming anywhere).
How can i prevent the console from closing very fast after running a programm (for instance when i compile "hello world" and let it run i see the console popping up but it closes so fast i can't recognize anything...)
Thanks for you tipps and advices!
Matthias
P.S.: Sorry for my bad englisch!
The simple solution is:
int main()
{
std::string str;
std::cout << "Hello world!" << std::endl;
std::cin >> str;
return 0;
}
#include <iostream>
int main()
{
std::cout << "Hello world!" << std::endl;
system("pause");
return 0;
}
might work fine as well...
wait, didn't the console runner program do that automatically? :?
Quote from: rickg22wait, didn't the console runner program do that automatically? :?
Hahaha yes it does. (checked)
But then, it doesn't seem to work for Matthias. :?
QuoteThe simple solution is:
aben, this is the way some other IDE does it. We provide the solution without you having to edit your code ;)
Matthias, if you 're still having problems, read this thread (http://www.codeblocks.org/index.php?name=PNphpBB2&file=viewtopic&p=1647#1647).
Yiannis.
Ok, the new console_runner you supplied adds this feature.
-Now I ask, is there any way to close the console automatically when my application terminates - some settings in the environment for instance?
Quote from: abenOk, the new console_runner you supplied adds this feature.
It seems that the supplied console_runner.exe with the finalbeta setup was screwed. Sorry guys.
Quote from: aben-Now I ask, is there any way to close the console automatically when my application terminates - some settings in the environment for instance?
LOL! I never expected this. It was always the other way around :lol:
Anyway, submit a feature request and I 'll make it configurable.
Yiannis.
Feature request submitted...
I believe that it would really begin to annoy me if I had to press enter after each run. -So for now I'll use the "screwed" version of the console_runner :)