[vtkusers] Crash when vtkObjectBase::Print() is used !
th.zamofing at freesurf.ch
th.zamofing at freesurf.ch
Wed Mar 12 07:29:05 EST 2003
When Print Method is used, the programm crashes. It seems to be some error
in the iostreams.
The Example Code:
#include "stdafx.h"
#include "vtkObjectBase.h"
#pragma comment(lib, "vtkCommon.lib")
using namespace std;
int objPrint( int argc, char *argv[] )
{
vtkObjectBase* base=vtkObjectBase::New();
base->Print(cout);
return 0;
}
I used the NighlyBuild of vtk_07_Mar_2003.
The code fragment where the library crashes is:
void vtkObjectBase::Print(ostream& os)
{
vtkIndent indent;
this->PrintHeader(os,0);
this->PrintSelf(os, indent.GetNextIndent());
this->PrintTrailer(os,0);
}
Changing to the following code and it worked. But what is the problem ???
void vtkObjectBase::Print(ostream& os)
{
vtkIndent indent;
strstream str;
this->PrintHeader(str,0);
this->PrintSelf(str, indent.GetNextIndent());
this->PrintTrailer(str,0);
str << ends;
os << str.str() << endl;
str.freeze(0);
}
It seems that if a ostream is passed not all outputs works:
os << ?a? OK
os << ?fdsgfhg? OK
os << (short)300 CRASH
os << (int)300 CRASH
? but why ?
Please Help
Thanks
Thierry
sunrise premiumsurf - geben Sie sich nicht mit weniger zufrieden
http://internet.sunrise.ch/de/internet/int_sps.asp
More information about the vtkusers
mailing list