- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why not use the buffered_io facility of the compiler, which could be set for specific files?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page