[vtk-developers] vtkOStrStreamWrapper

Gary J. Templet gjtempl at sandia.gov
Wed May 14 14:28:01 EDT 2003


Hi,

I'm attempting to use vtkOStrStreamWrapper to read data values into a
vtkstd::string. I'm having a problem clearing the vtkOStrStreamWrapper
for reuse and was wondering if anyone could offer advice.

For a std:ostrstream, the following syntax seems to allow you to
overwrite the existing contents of the buffer:

                ostrstream buffer;
		........
                buffer.freeze(0);
                buffer.seekp(0, ios::beg);
		........


So, I tried the following using vtkOStrStreamWrapper:

		vtkOStrStreamWrapper vtkbuffer;
		......
                vtkbuffer.rdbuf()->freeze(0);
                vtkbuffer.GetOStream().seekp(0, ios::beg);
		......

but subsequent code like

		vtkbuffer << "Hello, VTK. Pi ia approx " << 3.14 << endl;

don't seem to change the contents of the vtkOStrStream. 

It appears that vtkOStrStreamWrapper::freeze(false) only sets the
vtkOStrStreamWrapper->Frozen data member and does not freeze/unfreeze
the underlying buffer.

Or, is there some other way to overwrite the contents of a
vtkOStrStreamWrapper?

If anyone has experience with this, I'd greatly appreciate your advice.

Many Thanks,
Gary





More information about the vtk-developers mailing list