I understand what functions like setbuf do (set block buffering, line buffer, or no buffering). But what is the purpose for change the type of buffering used by a stream? Under what circumstances would you change the buffering type, and why?
I understand what functions like setbuf do (set block buffering, line buffer, or no buffering). But what is the purpose for change the type of buffering used by a stream? Under what circumstances would you change the buffering type, and why?
You might want to disable buffering to get keypresses immediately.
Maybe your program reads in thousands of files that are three characters larger than the buffer size: it would be more efficient to change the buffer size to three characters larger.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
That makes sense. Thanks