Is it possible to use streambuf directly ?

I'd want to have a method to put and get data into memory, as it was a file, but in memory.
As I have seen, I only can use filestream and stringstream ?
Thanks
streambuf is an abstract class. Is there anything wrong with stringstream?
Thanks hamsterman.
My problem is that I dont know how to reserve 65536 bytes for the stringstream.

I'm going to do the next operations until I have no space into my 'buffer'
s.write ( reinterpret_cast<char*>( &double ), sizeof double );
s.write ( reinterpret_cast<char*>( &int ), sizeof int );
....
So I'd like to have a `reserved space' to increase the perfomance.

Or maybe I have not to do it ?
I guess you could have a buffer and then write that..
Though I don't see why you need a stream at all..
If you are just looking for a buffer, you can effortlessly write your own.
Topic archived. No new replies allowed.