Sign in to follow this  
tonymontana

Making your own stream objects

Recommended Posts

tonymontana    100
I am thinking of making my own stream object.That object will use Platform specific codes (WINAPI for windows ...) to write binary code to a file(harddisk).it will have its own buffer overflow mechanism ,flush() vb..functions and features.(for example; my stream object will manage when it will flush from buffer to harrdisk , i want to create a stream object that will only flush one time (it will store big amount of data and then writes this at once..) Is there a tutorial for that ? or how can i find source for this? Also one last question is how can implement this platform-independent?

Share this post


Link to post
Share on other sites
Bregma    9199
If you're using C++, what you want to do is derive from std::streambuf (not std::iostream and its cousins). You replace the streambuf in a regular stream using the rdbuf() member function.

Google for streambuf to find a tutorial, or get the Langer and Kreft book.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this