[vtkusers] a bug in void vtkXMLShader::ReadCodeFromFile(const char* filepath)

charlie_zhang at moldflow.com charlie_zhang at moldflow.com
Fri Mar 28 00:08:23 EDT 2008


Hi,

I'm using the  Cg/GLSL shader feature in VTK5.2 overnight build and come
across a bug in  vtkXMLShader::ReadCodeFromFile(const char* filepath).

The issue is: if the file has carriage/return then the "this->Code" char[ ]
always has some unwanted characters at its end.

 It turned out the length includes all the carriage/return, but when
ifp.read(this->code,length) it stripped out all the carriage/return.  To
fix this issue I changed the "ifp.open( filepath)" to "ifp.open(filepath,
ios::binary)" so the read() will read in the carriage/return as well.


Charlie




More information about the vtkusers mailing list