473,508 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 22 '05 #1
4 1454
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.

Jul 22 '05 #2
"Patio87" <pa*****@aol.com> wrote in message
news:20***************************@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


Jul 22 '05 #3
Ivan Vecerina wrote in news:cf**********@newshispeed.ch in
comp.lang.c++:
"Patio87" <pa*****@aol.com> wrote in message
news:20***************************@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/
Jul 22 '05 #4
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.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1379
by: John D. | last post by:
I have a Python program which runs as user 'www' (it's a CGI). It needs root privilege to write a particular file. What's the best way of doing this while remaining secure? Right now I do...
6
8752
by: haynesc | last post by:
Hi, I'm having a problem where when trying to open a file in write mode, I get an IOError stating no such file or directory. I'm calling an external program which takes an input file and...
2
7620
by: Thang Nguyen | last post by:
Hi, my page contains an applet. When I click on a link on the page, the applet will be launched.Now I need my page can be automatically closed when I close my applet.I can call the script from my...
2
1748
by: dubian | last post by:
I would like to propagate an event signal to an external application when a table in my MSSql2000 server is updated. Prog A; I have an external application adding records to a table. Prog B; I...
9
1584
by: Bastian.Zacher | last post by:
Hello NG, I want to write a c-prg. which examines the current memory-usage and cpu-usage of the system (win32), and writes the values to a logfile. Does anybody know which librarys or...
5
1484
by: Boni | last post by:
Dear all, is it possible to open .NET shell programmatically? Thanks, Boni
2
1809
by: tomko | last post by:
Hi, My program uses the Process class to start a bat file that starts an exe. When I run my program inside Visual Studio (debug) the bat and exe run in the background (are not visible) and all...
2
1379
by: kingsolomon2000 | last post by:
Hi! Can anyone please show me an example how to write a very simple C program such that it runs on a specific processor? I want to run a very simple program, 2 programs identical, and one runs...
8
2194
by: damod.php | last post by:
Iam a php/mysql developer. I wanna know whether staying in php and mysql forever would affect my future. Most s/w people are in either java or dotnet. Iam novice in both of them. I love php and i...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.