473,466 Members | 4,879 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Automatic Closing?

HHH
Can someone tell me why does my c++ program always close straight away when
i open it. For example, i had made a build version of my first program
"Hello World", and when i tried it, it opened and closed. Is there a code i
have to right or something?
Jul 22 '05 #1
2 1866
If your program is a console program it's supposed to do that when you run
in debug mode. In this case, insert a delay or "press any key"
functionality at the end.

You can run the program in execute mode (ie, CTRL-F5), then the compiler
will do a "press any key" thing for you.

Also, you might have a better time in comp.os.ms-windows.programmer.win32
for product-specific questions.

--
gabriel
Jul 22 '05 #2
HHH wrote:
Can someone tell me why does my c++ program always close straight away when
i open it. For example, i had made a build version of my first program
"Hello World", and when i tried it, it opened and closed. Is there a code i
have to right or something?


Unless your program prompts the user for input (hint!!!)
or delays, the operating system is allowed to terminate it
after its execution.

In some windowing operating systems, a new window is opened
for an application. As soon as the application is finished,
the window closes. In these scenarios, most programmers
employ a "press any key" prompt for the user.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #3

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

Similar topics

6
by: Gert van der Kooij | last post by:
Hi, It's no problem to define the automatic maintenance using the wizard but I want to use commands to automate automation. I captured the SQL statements when activating the maintenance but that...
1
by: Franck Foschiatti | last post by:
How can I save new values in a table and directly see it in a form combobox without closing and re-opening the form and without losing the entered values? The second use is to do a request...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
8
by: NickP | last post by:
Hi there, Either I have come across some kind of "undocumented feature" or I have a rather curiously irritating bug. When typing the intellisense is going into full bork mode and actually...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
8
by: Erik de Castro Lopo | last post by:
Hi all, Consider the following code snippet: do { int r = rand () ; } while (r != 0) ; It seems the compiler I'm using (GCC) does realise that the
3
by: cj | last post by:
My program shuts itself down and reboots the pc it's running on at 2:00am twice a week and has been doing so without fail for over a year. But twice in the past month it's been found running in the...
5
AllusiveKitten
by: AllusiveKitten | last post by:
Hi all, I really hope I can explain myself properly, I have set up coding to send multiple automatic emails which is working super! Each email that is being sent I receive the security Pop up box...
18
by: ismailc | last post by:
Hi, I want to execute a javascript in my xslt file. that does the following! this script launches a popup window without the Windows frame or titlebar ...
3
by: myjish18 | last post by:
Hello, We have a DB2 UDB database v8.2.7 (db2 v8.2 fixpak 14) on AIX 5.3 which has Automatic Storage (AS) enabled. We want to disable automatic storage on entire database and/or disable...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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
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
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...

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.