PDA

View Full Version : Why won't my windows stay open


Draco2003
2006-04-03, 01:09 AM
My computer doesn't let my Command Line windows stay open.

They are open for a split second, but close faster than Flash high on caffeine. I need help because I am trying to learn C++ and my projects are all in command prompt style.

If it helps, I am using Bloodshed DevC++.

Dunno if its the program, or if its windows, but its only the Command Line windows that don't stay open.

Thanks for the help.

Demosthenes
2006-04-03, 01:20 AM
Add a function to accept input at the end of your code. What it's doing is it's running your code from start to finish like its supposed to, but once it displays the output it closes because there is no more code left for it to run. It's the same thing that would happen if you went to start >> run and then typed ping xxx.xxx.xxx.xxx.

WetWired
2006-04-03, 07:47 PM
There used to be a pif file somewhere in the Windows directory that you could edit and uncheck close on exit to change this behaviour, but adding getch() to the end of the program works equally well and doesn't have annoying side-effects.