Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • OrenFebruary 18, 2009 3:41 PM PST   
    "Fully buffered" ofstream wrapper class -- Any thoughts?

    Hi all,

    Here is my wrapper class for ofstream. I would greatly appreciate any comments and suggestions. Even more importantly, if I've just reinvented the wheel, please point me towards the original, because it's almost certainly better than my version.

    Specification:
    Must not write to file until explicitly flush() ed.
    Must support both formatted << and unformatted write(ptr, size) operations.
    Must expose an ostream object to be passed to functions
    * All my objects have a WriteBinary(ofstream&) member function that would be nice not to have to rewrite/overload
    Performance is appreciated.

    http://pastebin.com/m7272cbf0

    Thanks in advance!

    ~Oren

    TimP (Intel)February 18, 2009 4:07 PM PST
    Rate
     
    Re: "Fully buffered" ofstream wrapper class -- Any thoughts?

    Why not use the buffered_io facility of the compiler, which could be set for specific files?


    OrenFebruary 18, 2009 4:34 PM PST
    Rate
     
    Re: "Fully buffered" ofstream wrapper class -- Any thoughts?

    Quoting - tim18
    Why not use the buffered_io facility of the compiler, which could be set for specific files?

    My understanding was that fstream cannot fulfill the first requirement of the specification under any conditions.

    This is a hard (must) requirement.


Forum jump:  

Intel Software Network Forums Statistics

16,371 users have contributed to 46,346 threads and 163,988 posts to date.

In the past 24 hours, we have 15 new thread(s) 83 new posts(s), and 61 new user(s).

In the past 3 days, the most popular thread for everyone has been Formula for the intersection of straight lines The most posts were made to Take a look at John Burkhard&# The post with the most views is \"-check none\" generates error

Please welcome our newest member claudepi


For more complete information about compiler optimizations, see our Optimization Notice.