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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.