   Making your own stream objects
  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?   
  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.   ;This might help you out a bit.   