memort stream

Levente Farkas lfarkas@mindmaker.hu
Thu Oct 4 10:33:00 GMT 2001


Phil Edwards wrote:
> 
> On Wed, Oct 03, 2001 at 03:06:34PM +0300, Emre Turkay wrote:
> > Is there a memory only stream in C++ standards or in libstdc++. Just
> > like fstream but stored in the memory instead of a file ?  I don't mean
> > strstream.
> 
> That's like asking, "how do I turn a car without using the steering wheel?"
> :-)  The strstream classes have been replaced by stringstreams, which do
> the memory handling for you; they are based on std::string rather than
> on char*.  Look for the <sstream> header.

not exactly:-( suppose I'd like to read a binary file's content into
the memory once (to save file i/o operation in order to make it faster)
than a factory create object which can initialize itself from the 
binary stream. so I'd like to give the factory a stream which has 
the content of the binary file. currently iy's not solvable with
stringstream (but strstream), since istringstream.rdbuf()->pubsetbuf(..)
do nothing:-( so what is the solution?

 -- Levente                               "Si vis pacem para bellum!"



More information about the Libstdc++ mailing list