why do IDE output window close?

can anyone tell me why is it when i use an IDE such as devc++ or wxdev++ i need to put something like system("pause") or cin.get() in order for the output window not to immediately close? however, on the ms-dos command line, i don't need to do it?

why do IDEs output windows do this?
Last edited on
1) There is probably an option to let dev-c++ keep the commandline open. If not, it sucks even more than I thought it does.
2) It generally doesn't have anything to do with IDE or not IDE - if your program is trying to output something on a command line window if cout or cin refer to cmd.exe (default) in your program, but it wasn't called from the command line, it will create a new cmd.exe process that immediately terminates after your program finishes execution.
3) Don't use Dev-C++. Maybe wxDev-C++ as that's at least still actively developed. But I'm not sure if it's really THAT much better.
Reason: http://cplusplus.com/articles/36vU7k9E/
Last edited on
it's the same for both, i have both devc++ and wxdev++
As I said, there's probably an option to keep it open SOMEWHERE.
@douas, did you even read my topic? i said i already know how to stop the output window from disapearing, i just waned to know why it disappearing @ hanst99 there is no such option.
Well, sucks for you then. But wxDev-C++ should provide a wxWidgets GUI builder, just use that instead of outputting on the console.
closed account (1vRz3TCk)
... i just waned to know why it disappearing
Why should it do any different? Your program requires a console, so one is created for it to use. When your program finishes the console is no longer needed and is removed. This is just how windows works.

Now your IDE may spawn a CLI and run your program in that, in witch case it will have control over whether or not to remove it on completion.
CodeMonkey I don't know, that sounds like shooting a bird with a battleship to me.
Last edited on
closed account (1vRz3TCk)
CodeMonkey I don't know, that sounds like shooting a bird with a battleship to me.

???
Last edited on
Aye. Creating a GUI purely because you don't like running a programme from a console? Surely that is much more shooting a bird with a battleship.
I meant moving to GUI programming altogether, not just for the sake of keeping the program open.
closed account (1vRz3TCk)
I still don't understand what sounds like shooting a bird with a battleship.
Forget it, it's not really important. I have just misinterpreted what you wrote. Happens to me a lot lately. Maybe I should take more walks, I heard that helps you clear your head.
I agree with hanst99 you should start using a library like allegro, sdl, or sfml from the start. (I wish I had as i only use 70% of what I learned in console programming with graphical programming)
jinjin12 wrote:
@douas, did you even read my topic? i said i already know how to stop the output window from disapearing, i just waned to know why it disappearing

Yes. Did you even read the first paragraph in the link I gave you? (I don't believe you did.)

Duoas wrote:
This is typically a problem on Windows, caused by really dumb IDEs that don't know enough to keep the console open after the program finishes. However, it does strike right at one of the main philosophical problems with the way you are thinking about programming. After all, a console program should be run from the console --else once it terminates, the console should disappear. We'll get to fixing that later. For now, we'll stick with the immediate problem.

The console represents a hardware device -- a text terminal (keyboard and video display). Programs are much more transient than the hardware (keyboard and video display). When a textual application starts, the application connects to the terminal -- not the other way around.

Since windowed (GUI) systems came about, we have had a nice new type of operating environment, where the user need not use a text terminal at all. Combined with something nice called "multitasking" -- the ability to execute and interact with multiple applications at the same time -- the people at Redmond did something smart: If your application requires a text terminal, the OS will create one (a console window), ready before your application starts, so that your text application can connect to it and operate properly. Once your application terminates and detaches itself from the console, then Windows does the Right Thing and gets rid of that unused console window.


The article I posted for you was also in response to your methods of keeping the console window open, which are, frankly, wrong. Rather than an unfriendly "you're doing it wrong," I was considerate enough to post the proper ways to do it for you.

True, the article does not say, "this is not an IDE issue," but a simple read would direct you that it is the way you are thinking -- a console application should be run from the console (and not any other way) if you want to keep the console around when your program is done.


Now, is that a good enough answer for you? Do you wish to be rude again? Perhaps you ought to consider that you missed something before casting stones about. If I (or anyone else) did, in fact, misunderstand you, you are much more likely to get a useful answer if you attribute it to a simple misunderstanding rather than an aggressive, "WHY ANSWER IF YOU AREN'T PAYING ATTENTION". You cannot deny that that is effectively the meaning of, "did you even read my topic?" and "i said i already know how to...".

Oh, and now you are on my "ignore" list. Congradulations.
Topic archived. No new replies allowed.