Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

rajmerai Group Title

what is the use of fflush(stdin)in c language

  • one year ago
  • one year ago

  • This Question is Open
  1. Cynosure-EPR Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I believe it flushes the input stream (meaning, clears it out). It is implemented as sometimes invisible characters (new lines/line breaks) get stuck in there. There are other ways to handle these characters without flushes.

    • one year ago
  2. JeanPaulvanHamond Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    fflush(stdout) is very useful for making sure that all buffered output has been flushed out (usually to a disk file or the terminal). If you don't use it, then Odd Things can happen (for instance, a prompt appearing *after* you do the corresponding read from the terminal, or the last bit of output from the program never actually making it into a disk file). Since fflush() is only defined for "output" streams, it's a good way to generate an EBADF (bad file descriptor) for calling it on a non-output stream.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.