Re: [Dev-C++] RE: I just got the Dev-C++. Why is it that when I select
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Steve D. P. <ste...@ho...> - 2001-06-14 03:25:52
|
> I'm a novice. I just got the Dev-C++. Why is it that when I select
> Console Application for simple project, i.e. "Hello World" , as soon
> as I run the program, the screen switches into Dos and back to
> Windowa at lightning speed, I can't even see what the computer did.
> How can I tell the program to go to DOS and stay there? Or better
> yet, how can I execute these simple programs from the Dev-C screen
> without even going to DOS?
The "Hello World" template creates a console-based app... which executes
in a console window. The default characteristics of console windows are
adjusted in slightly different ways depending on the particular version of
Windows you're talking about... but they all have the option of either
closing on exit or not. "Close on exit" means that a console window created
to run a console app will automatically close once that app exits...
otherwise you will get a "Press any key to continue..." prompt before the
window closes.
The reason that your console windows flashes by is that your system is
configured for "close on exit". Since there are so many different ways to
control this behavior depending on your Windows version (and I don't know
all of them), I'm not even going to suggest that you try to fix the
"problem" by exploring that route. The easier solution would be to use this
line in your program right before the program exits:
system("PAUSE");
This will invoke that "Press any key to continue..." prompt I mentioned
earlier, and keep your console session from flashing by so quickly.
|