How large is the stream buffer?

Discussion in 'C++' started by Lambda, Jul 15, 2008.

  1. Lambda

    Lambda Guest

    As I know, when I use ifstream and ofstream to read and write file,
    it will use a stream buffer internally.
    How large is the stream buffer?

    If I want to write a large file, need I define a stream buffer myself?
    In what situation, user-defined stream buffer is useful?
    Lambda, Jul 15, 2008
    #1
    1. Advertising

  2. Lambda

    James Kanze Guest

    On Jul 15, 2:28 pm, Lambda <> wrote:
    > As I know, when I use ifstream and ofstream to read and write file,
    > it will use a stream buffer internally.
    > How large is the stream buffer?


    About so big.

    It depends on the implementation, and will often be optimized
    for the system you're running under.

    > If I want to write a large file, need I define a stream buffer
    > myself?


    No.

    > In what situation, user-defined stream buffer is useful?


    Any time the non-standard ones aren't sufficient. The most
    frequent use is probably filtering streambuf's; it's hard to
    imagine an application that doesn't use at least one (if only
    for log dispatching). Non-filtering user written streambuf's
    are used to interface with sockets, pipes, raw memory, or just
    about anything else besides ordinary files and std::strings.

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orientée objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
    James Kanze, Jul 15, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raja
    Replies:
    12
    Views:
    24,350
    John Harrison
    Jun 21, 2004
  2. Replies:
    2
    Views:
    590
    sergejusz
    Mar 26, 2007
  3. Neal Becker

    buffer creates only read-only buffer?

    Neal Becker, Jan 8, 2009, in forum: Python
    Replies:
    0
    Views:
    402
    Neal Becker
    Jan 8, 2009
  4. xingye
    Replies:
    9
    Views:
    264
    Michael Lu
    Apr 19, 2004
  5. Roedy Green

    byte stream vs char stream buffer

    Roedy Green, May 7, 2014, in forum: Java
    Replies:
    20
    Views:
    167
    Silvio
    May 18, 2014
Loading...

Share This Page