473,666 Members | 2,264 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 1463
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.co m> 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.co m> 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
1387
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 os.system("sudo myutil parms") and pass the parms to it. I remove : < > & | from the parm string before passing it. Is there a way to do this without making a system call? i.e. gimme_root() my code...
6
8760
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 produces an output file repeatedly, simulating the input file separately for each replicate. The error occurs when trying to open the input file to write out the new data. The problem is difficult to reproduce since it only shows up once every few...
2
7635
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 applet to do this, but the poor thing is each time the script is called, IE will prompt to ask "the page you are viewing try to close the window ..". Is there any possible way for the browser not to prompt like that. I only know that a closing a...
2
1760
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 have another external application using this table as well. When Prog A creates a new record in the Table, how can I have Prog B be notified of the event without polling the table or creating a link between Prog A and Prog B.
9
1591
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 functions I should use? Unfortunately I'm almost new to programming in c :-(
5
1490
by: Boni | last post by:
Dear all, is it possible to open .NET shell programmatically? Thanks, Boni
2
1813
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 their output is redirected to my stream reader. But when I try to run my program outside the IDE, the exe starts in it's own window and my prgram is put on hold. When I exit the started program the output of the bat is flushed to my stream.
2
1390
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 one one processor and the other program (same one) runs on a different processor. How do I specify which processor in the code to force the program to
8
2199
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 dont wanna shift from it. Please tell me whether staying as a php developer is good enough to have a settled future in spftware industry. Pro's and Con's respected.
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6191
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2769
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 we have to send another system
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.