dev-c++ Premature Closing

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 1
Reputation: CodeIt is an unknown quantity at this point 
Solved Threads: 0
CodeIt CodeIt is offline Offline
Newbie Poster

Re: dev-c++ Premature Closing

 
0
  #11
Feb 17th, 2005
Originally Posted by xinix
Hey all, I posted a question earlier this week regarding dev-c++ and my inability to keep the output window (#include <iostream>) open long enough to see my program running!

I have already tried the following things and would be grateful for any other suggestions!

1:
(Without typing using namespace std \\At the top
std::cout << "Press enter to exit";
std::cin.ignore(std::cin.rdbuf()->in_avail + 1);
return 0;

2:
(Typing using namespace std \\At the top
cout << "Press enter to exit";
cin.ignore(cin.rdbuf()->in_avail + 1)
return 0;

3:
#include <cstdio> \\At the top
cout << "Press enter to exit";
getchar();
return 0;

Someone please help! I seem to have tried everything! If anyone knows dev-c++, could you give me a sure fire way of keeping the output window open! Thank you!

(And thanks to the guys or gals who have already suggest ways to help!)
I am new too C++ but try this at the end of code in main before return statement system("pause"); this should work as it has been doing so for me for some time, but i find it does not work with the old style header files meaning the .h files and namespace. also dev appears not like cstidio or cstring instead replace without the C
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 5
Reputation: ANRCCC is an unknown quantity at this point 
Solved Threads: 0
ANRCCC ANRCCC is offline Offline
Newbie Poster

Re: dev-c++ Premature Closing

 
0
  #12
Feb 17th, 2005
Originally Posted by xinix
Hey all, I posted a question earlier this week regarding dev-c++ and my inability to keep the output window (#include <iostream>) open long enough to see my program running!

I have already tried the following things and would be grateful for any other suggestions!

1:
(Without typing using namespace std \\At the top
std::cout << "Press enter to exit";
std::cin.ignore(std::cin.rdbuf()->in_avail + 1);
return 0;

2:
(Typing using namespace std \\At the top
cout << "Press enter to exit";
cin.ignore(cin.rdbuf()->in_avail + 1)
return 0;

3:
#include <cstdio> \\At the top
cout << "Press enter to exit";
getchar();
return 0;

Someone please help! I seem to have tried everything! If anyone knows dev-c++, could you give me a sure fire way of keeping the output window open! Thank you!

(And thanks to the guys or gals who have already suggest ways to help!)

Did you try
system("pause");
return 0;
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 5
Reputation: ANRCCC is an unknown quantity at this point 
Solved Threads: 0
ANRCCC ANRCCC is offline Offline
Newbie Poster

Re: dev-c++ Premature Closing

 
0
  #13
Feb 17th, 2005
did you try

system("pause");
return 0;
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 17
Reputation: bonnie1702 is on a distinguished road 
Solved Threads: 0
bonnie1702 bonnie1702 is offline Offline
Newbie Poster

Re: dev-c++ Premature Closing

 
0
  #14
Nov 30th, 2008
Its simple. Use getch() to hold the screen. You must include the conio.h header file when using getch(). You place it at the end of your code just before the return statement in main().
See below for demo:
  1. #include <iostream>
  2. #include <conio.h>
  3. int main()
  4. {
  5. cout << "hello world";
  6. getch();
  7. return 0;
  8. }
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,835
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 503
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: dev-c++ Premature Closing

 
0
  #15
Nov 30th, 2008
This thread is over three years old. conio.h is non-standard. cin.get () is standard. See this thread for how to keep the command window open.

http://www.dreamincode.net/forums/showtopic30581.htm
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC