purpose of stream buffering operations?

This is a discussion on purpose of stream buffering operations? within the C Programming forums, part of the General Programming Boards category; I understand what functions like setbuf do (set block buffering, line buffer, or no buffering). But what is the purpose ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    57

    purpose of stream buffering operations?

    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?

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,047
    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.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    57
    That makes sense. Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  2. Buffering??
    By Brain Cell in forum C Programming
    Replies: 15
    Last Post: 09-21-2004, 06:57 AM
  3. Matrix and vector operations on computers
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-11-2004, 06:36 AM
  4. Replies: 9
    Last Post: 07-01-2002, 07:50 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21