Control ofstream buffering?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • idesilva@eudoramail.com

    #1

    Control ofstream buffering?

    Hi,

    I have an app that generates a text log at a very high rate. Currently
    I use an ofstream object to write the log. I would like to control when
    'exactly' the log is written to the disk. Also I want to be able to
    reset the buffer contents without writing them to the disk file.

    - Can the 'buffer size' of an ofstream object (in fact, any iostream
    lib object) be controlled?
    - Can we control *when* the buffer is flushed? [I want ofstream to
    flush *only* when I invoke flush(). The default 'nounitbuf' behavior
    doesn't do what I want]
    - Is there a way to *reset* the ofstream buffer?

    Thanks,
    Ishan.

Working...