Hello!As a newbie programmer I don't know how to freeze my command line output,when I execute a C program,in order to see the output.Output opens and closes very fast.The trick I know from Pascal to put a 'Readln' statement as a last line doesn't work(with a 'scanf' or something like that.Could anybody give me a clue about that?Thanks in advance.
wonder87
0
Newbie Poster
Recommended Answers
Jump to PostThis was the most frequently asked question once in dev-c++ forum, and i'm the most sure this topic has already been discussed many times in this forum as well. Maybe the shortest answer, use only fgets for input, this is the only right function for input, as it restricts the …
Jump to PostA common way of pausing the program is to make use of the standard function getchar().
scanf() behaviour will mess up your ability to pause the program with getchar() sometimes. Read about it
Jump to PostBut if you still want to use some weird input methods, like cin, then you have to put fflush (stdin); before getchar.
Best way is to avoid any `weird input methods' and do not start even
using fflush( stdin ) at all.
Jump to PostYes that's right, effect of fflush is undefined for stdin and it of course must not be used. But if they already do things insecurely, then they must use other uncertain things to compensate it, nothing to do, their choice. Then i say again that these who read would better …
Jump to Post>Yes that's right, effect of fflush is undefined for stdin and it of course must not be used.
Then why did you tell the OP to use it?>But if they already do things insecurely, then they must use other uncertain things to compensate it
There are better ways …
All 17 Replies
TkTkorrovi
69
Junior Poster
Aia
1,977
Nearly a Posting Maven
Aia
1,977
Nearly a Posting Maven
TkTkorrovi
69
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
TkTkorrovi
69
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
TkTkorrovi
69
Junior Poster
TkTkorrovi
69
Junior Poster
dr4g
25
Junior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
dr4g
25
Junior Poster
Aia
1,977
Nearly a Posting Maven
iamthwee
Aia
1,977
Nearly a Posting Maven
iamthwee
Aia
commented:
Do you think I care about understanding your main point?. The answer is the say I said in the post. No!.
-1
Aia
1,977
Nearly a Posting Maven
iamthwee
commented:
Um, I don't think you understood the main point of my post. Oh well in time you will learn :)
-2
arjunsasidharan
commented:
He's a retard. :)
+3
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.