Thread: Stdin buffer

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    But it does process one character at a time. Type any character and press enter. Then run it with a different length input. The only difference is when you press enter. Your experiment results mean that stdin is line buffered. In other words, scanf will read until a whole line is in stdin and then only return the first character. Subsequent calls to scanf will be streamed from stdin, until after the '\n' character is encountered.

  2. #2
    Registered User
    Join Date
    Dec 2010
    Posts
    3
    Thank you for the concise explanation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Function call from another .c module
    By Ali.B in forum C Programming
    Replies: 14
    Last Post: 08-03-2009, 11:45 AM
  3. stdin buffer size
    By Kempelen in forum C Programming
    Replies: 6
    Last Post: 03-16-2009, 03:06 PM
  4. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 05:15 AM