| | |
Cant execute a c++ program
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2004
Posts: 2
Reputation:
Solved Threads: 0
i'm using Dev C++, and when i write a program, it compiles it fine then when i execute it the program window closes after the program has finished.
does anyone know how to keep the window open. im running on XP(SP2).
i've tried right clicking on the .exe but theres nothing there to stop it closing.
Thanks
does anyone know how to keep the window open. im running on XP(SP2).
i've tried right clicking on the .exe but theres nothing there to stop it closing.
Thanks
You can open up a command line prompt and run the program that way, but the more common solution is to ask for input at the end of the program so that a blocking read pauses execution:
This generally works unless there's still data left in the input stream, in which case your problem becomes one of flushing the input stream.
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { // Your program here cin.get(); // Blocking read to pause }
New members chased away this month: 5
![]() |
Similar Threads
- Execute on program close? (C++)
- How to execute a program within another program? (C++)
- How to Prevent duplicate execute of my program ? (C#)
- how to execute an *.exe file in a c-program? (C)
- execute a c program (Assembly)
- VB6 - Generate a new/blank sheet each time I execute my program. (Visual Basic 4 / 5 / 6)
- help : external program wont execute. (Visual Basic 4 / 5 / 6)
- Problem trying to run old fortran based program in win xp (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: How to code a program that can play sound
- Next Thread: Ideas needed for problem with trailing whitespaces
Views: 3489 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






