Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   dos promt staying open when prog runs (http://www.velocityreviews.com/forums/t285088-dos-promt-staying-open-when-prog-runs.html)

Patio87 08-18-2004 07:42 AM

dos promt staying open when prog runs
 
I was wondering why when I run a program in my DEV C++ the dos promt doesnt
stay open? it just displays for like a milisecond and exits. Thanks

Rolf Magnus 08-18-2004 09:28 AM

Re: dos promt staying open when prog runs
 
Patio87 wrote:

> I was wondering why when I run a program in my DEV C++ the dos promt
> doesnt stay open? it just displays for like a milisecond and exits.
> Thanks


A shortcoming of Windows. Try opening it yourself and starting your
program from there.


Ivan Vecerina 08-18-2004 09:32 AM

Re: dos promt staying open when prog runs
 
"Patio87" <patio87@aol.com> wrote in message
news:20040818034251.15985.00002473@mb-m21.aol.com...
>I was wondering why when I run a program in my DEV C++ the dos promt doesnt
> stay open? it just displays for like a milisecond and exits. Thanks

This is the case in several IDEs. If you want to see the output of your
program,
you need to explicitly keep your application open.
Consider adding a statement such as getchar();
or system("pause"); at the end of your program.

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form





Rob Williscroft 08-18-2004 11:46 AM

Re: dos promt staying open when prog runs
 
Ivan Vecerina wrote in news:cfv7ns$j4m$1@newshispeed.ch in
comp.lang.c++:

> "Patio87" <patio87@aol.com> wrote in message
> news:20040818034251.15985.00002473@mb-m21.aol.com...
>>I was wondering why when I run a program in my DEV C++ the dos promt
>>doesnt
>> stay open? it just displays for like a milisecond and exits. Thanks

> This is the case in several IDEs. If you want to see the output of
> your program,
> you need to explicitly keep your application open.
> Consider adding a statement such as getchar();
> or system("pause"); at the end of your program.
>


#include <iostream>

int main()
{
std::cout << "Press Enter\n";
std::cin.get();
}

Seems to work fine for me :), any old key press won't work though,
you have to hit enter.

Whats really nice is that if I run the above from my editor that
captures the output it doesn't hang (and I don't have to hit enter),
where as the <conio.h>/getch() version does.

Rob.
--
http://www.victim-prime.dsl.pipex.com/

Julie 08-18-2004 04:09 PM

Re: dos promt staying open when prog runs
 
Rolf Magnus wrote:
>
> Patio87 wrote:
>
> > I was wondering why when I run a program in my DEV C++ the dos promt
> > doesnt stay open? it just displays for like a milisecond and exits.
> > Thanks

>
> A shortcoming of Windows. Try opening it yourself and starting your
> program from there.


Shortcoming? No, (logical!) design.


All times are GMT. The time now is 09:39 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.