944,142 Members | Top Members by Rank

View Poll Results: Is this a common problem
Yes 2 100.00%
No 0 0%
It's you 1 50.00%
noob 0 0%
Multiple Choice Poll. Voters: 2. You may not vote on this poll

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 495
  • C++ RSS
Oct 8th, 2009
0

readout

Expand Post »
Hello people
I have jusrt recently started to study C/C++ and I am using Borland 5.02. I am having a problem examining my outputs. when I run a successfully compiled program the Dos window that I should read my print from flashes on then flashes off and I do not get the time to examine the results. Can any body tell me how to adjust the settings in order to read it.
Thanks
Fazzer2
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fazzer2 is offline Offline
4 posts
since Oct 2009
Oct 8th, 2009
1
Re: readout
Put a std::cin.get() (C++) or : getchar() (C) right before the return 0; in main().

C++ Syntax (Toggle Plain Text)
  1. int main(){
  2. // do stuff
  3. std::cin.get();
  4. return 0;
  5. }
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Oct 9th, 2009
0
Re: readout
Click to Expand / Collapse  Quote originally posted by niek_e ...
Put a std::cin.get() (C++) or : getchar() (C) right before the return 0; in main().

C++ Syntax (Toggle Plain Text)
  1. int main(){
  2. // do stuff
  3. std::cin.get();
  4. return 0;
  5. }
Thank you for the reply, but it does not seem to make any sense.
Is it all there? Is it relavent to the post about my DOS window not staying open to examine results
cheers
Fazzer2
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fazzer2 is offline Offline
4 posts
since Oct 2009
Oct 9th, 2009
-1
Re: readout
Click to Expand / Collapse  Quote originally posted by niek_e ...
Put a std::cin.get() (C++) or : getchar() (C) right before the return 0; in main().

C++ Syntax (Toggle Plain Text)
  1. int main(){
  2. // do stuff
  3. std::cin.get();
  4. return 0;
  5. }
I think I have it. If I put
int ch;
ch = getc(stdin)
the window stays open
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fazzer2 is offline Offline
4 posts
since Oct 2009
Oct 9th, 2009
0
Re: readout
So exactly why didn't you try my code?
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006
Oct 9th, 2009
1
Re: readout
Click to Expand / Collapse  Quote originally posted by niek_e ...
So exactly why didn't you try my code?
didn't understand it, but I do now
cheers
Reputation Points: 10
Solved Threads: 0
Newbie Poster
fazzer2 is offline Offline
4 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help With Pascal's Triangle in C++
Next Thread in C++ Forum Timeline: Live/Online Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC