Default input and output buffering for fopen'd files?

Posted by Evan Teran on Stack Overflow See other posts from Stack Overflow or by Evan Teran
Published on 2010-04-19T18:46:20Z Indexed on 2010/04/19 19:03 UTC
Read the original article Hit count: 303

Filed under:
|
|
|

So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior).

Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin/stdout/stderr, but what are the defaults for newly opened files? Are they buffered for both input and output? Or perhaps just one?

If it is buffered, does output default to block or line mode?

© Stack Overflow or respective owner

Related posts about c

    Related posts about file