|
From: Cary H. <xen...@gm...> - 2004-11-08 14:44:54
|
Hi all, I hope this will be of some help.
By default, win2k and xp close a console(dos) window when the program
that is using it exits. In 2k, you can change the behavior of a
window to remain open once the program exits until you close it
yourself. XP, however, does not have this "feature". In my
experience, it is easiest to add the call system("pause") right before
the program terminates so that the window remains open. Another
option is to open the run command, type cmd, and open a console
window, and run the executable that way.
If you decide to go the system("pause") route, remember to add a
#include <stdlib.h> // for c
#include <cstdlib> // for c++
Good Luck!
Cary Haynie
ps. on a side note, system() should support any legal dos command,
not just pause.
On Mon, 08 Nov 2004 14:55:23 +0100, shocked <sh...@po...> wrote:
>
>
> Haim Bishop wrote:
>
> > Hello
> > I have installed Dev-C++ 4.9.9.0
> > I am using windows xp
> > When I run a program I have wrote
> > opens the dos window and then it closes.
> > How can I do that it will stay open after the
> > program ends to run.
> > Thank you.
> >
> >
>
> Hi,
>
> This problem sometimes appears in this Mlist, but AFAIK it has no
> straightforward solution
> Some workarounds I saw are
> -to put as last instruction a 'system("pause")' or a 'getchar()' or
> something similar that wait for an input
> -to place the cursor onto the last instruction and use the
> run-until-cursor debug command
>
> These are not the best, because if your code has many exit points (e.g
> in case of error) the window will be closed anyway.
>
> Hoping this help you, I say "goodbye"
>
> Andrea S. Atzeni
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|