Author Topic: Prevent Console Application from closing to fast...  (Read 22109 times)

Matthias

  • Guest
Prevent Console Application from closing to fast...
« on: May 25, 2005, 01:40:18 pm »
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!

aben

  • Guest
Prevent Console Application from closing to fast...
« Reply #1 on: May 25, 2005, 02:57:19 pm »
The simple solution is:

Code

int main()
{
  std::string str;
  std::cout << "Hello world!" << std::endl;
  std::cin >> str;
  return 0;
}

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Prevent Console Application from closing to fast...
« Reply #2 on: May 25, 2005, 05:49:28 pm »
Code

#include <iostream>

int main()
{
std::cout << "Hello world!" << std::endl;
system("pause");
return 0;
}


might work fine as well...
this space is for rent

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Prevent Console Application from closing to fast...
« Reply #3 on: May 25, 2005, 06:08:14 pm »
wait, didn't the console runner program do that automatically? :?

Offline squizzz

  • Almost regular
  • **
  • Posts: 132
Prevent Console Application from closing to fast...
« Reply #4 on: May 25, 2005, 07:01:08 pm »
Quote from: rickg22
wait, didn't the console runner program do that automatically? :?

Hahaha yes it does. (checked)

But then, it doesn't seem to work for Matthias. :?
this space is for rent

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Prevent Console Application from closing to fast...
« Reply #5 on: May 25, 2005, 07:44:44 pm »
Quote
The 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.

Yiannis.
Be patient!
This bug will be fixed soon...

aben

  • Guest
Prevent Console Application from closing to fast...
« Reply #6 on: May 26, 2005, 10:11:59 am »
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?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Prevent Console Application from closing to fast...
« Reply #7 on: May 26, 2005, 12:17:30 pm »
Quote from: aben
Ok, 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.
Be patient!
This bug will be fixed soon...

aben

  • Guest
Prevent Console Application from closing to fast...
« Reply #8 on: May 26, 2005, 01:05:06 pm »
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  :)