473,883 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Program Closes

hi all,

im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks like this:

return 0;

}

anyone know what i'm doing wrong?

thanks, eric
Jul 23 '05 #1
1 3282
On Sat, 21 May 2005 06:00:26 UTC, "Eric Whittaker" <ew****@adelphi a.net>
wrote:
hi all,

im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks like this:

return 0;

}

anyone know what i'm doing wrong?

thanks, eric


Eric,

We need a little more information to help you. What kind of
program are you writing? If the code is small enough perhaps
some of it could be posted.

You mention that the end of your program has the above
statement. I'm going to guess that you wrote a simple
"hello world" type program. Thatwould indicate to me
that the program was a console program or whatever your
operating system calls it. Anyway, if you're using a
windows based view by running the program by "clicking
on it from Explorer under Windows" and the program is
just a console application, that is the correct behavior.
Two things are happening. One is that your program is
running. Second, once the program has run the
automatically started console session closed. To change
this behavior, open a console session and use the
command line to move to and run your program. When the
program is done you will still have the console window
open so you can view the results.

If you are talking about the above line being the
end of your program and the program have a graphics
interface (window), the end of the program will end
the window. In that case you need to provide some
method to keep the program open for a while longer.

If all else fails, ask one more question with your
program -- "press enter to end program" and wait
for input.

David

Jul 23 '05 #2

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

Similar topics

0
1404
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different documents (txt, MS Office files, pdf, pictures,…) from inside my app. It must start the file with the adequate external program (Notepad, MS Office programs, Acrobat Reader, some Picture viewer,... ) and be notified when this programs closes the...
5
7367
by: Phil Galey | last post by:
VB.NET 2002 on Windows 2000 SP 3 When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover over it with my mouse. If I don't hover over it to make it disappear and then open the program again, another one is added, resulting in a multiplicity of the icon in the tray. I've even tried setting its Visible property to false, followed by a call to the...
3
1290
by: Luke | last post by:
I have a program that exits just fine when you close it manually, but throws an unhandled exception when I try to log off windows. It suggests I enable the JIT debugger, but when I compile the program in debug mode and enable JIT debugging it closes fine, though the logoff process is aborted. I am using a couple of activex controls that .net generated wrappers for, so I don't know if that has anything to do with it, but my program closes...
2
1233
by: dkoco | last post by:
I have a C#.Net program that once a button is clicked it goes to a public class(called Tal) and gets data in a vector, then exits the class, and goes back to the main form(program). I will do this task over and over. I want to take the data ,do many(over 20) calculations, and go back to the program. How can I get access to the data array(vector) from the main program? I keep getting different errors and have tried so many different ways. Thanks...
1
3998
by: amir | last post by:
Hello all, I have a db file .mdf in my program. I wander if it saves it everytime values are inserted and if not how can it be done ? furthermore i want to know where can i see the .mdf file after the program closes and with what program. cheers, amir.
4
1993
by: canteyn | last post by:
Ok here is my problem. I am coding a program that uses 3 different functions, and the end result is that the program reads in (x,y) points from a file, and then outputs those points to another file, and then calculates the area of the points(which form a polygon). I am able to compile the program just fine, but every time I try and run the program I just get a "segmentation fault". It may be in regards to my arrays, in fact I am almost sure...
3
1300
by: manontheedge | last post by:
I'm having a problem when I work with Access using VB6. I don't have a problem controlling Access, but I want the Access file to stay open when the program ends...but it always closes itself, and I don't know why. I stepped through my program, and it stays open literally until the second the program stops running. How can I get it to stay open and visible on the desktop...is there some trick to it? it's really strange, I know I'm opening...
2
9166
by: revenant81 | last post by:
I'm writing a program which has to execute a command, get its output and show it on a treeview. This command runs for a very long time. I want to end the execution of the command when the user closes my application. Right now I'm using an object my_child of type subprocess.Popen to execute the command, inside a thread with an infinite loop where we constantly ask for its output.
4
1877
by: Jonny Relentless | last post by:
After adding a form to a C# program, I am unable to use it. I want to use form1 as a sort of menu, so that when the user clicks a button, form1 will close and form2 (or form3, etc) will open. What code must I write to make this happen? I am new to programming, so go easy on me with the explanation please. Thank you for any help you can offer.
0
10734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10838
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
9569
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7967
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
7119
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
5794
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...
0
5988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4607
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
3
3230
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.