[vtkusers] STL Reader bug solved...

Gregory Bleiker gregory.bleiker at phonak.ch
Tue Nov 19 05:15:58 EST 2002


Hi all,
I posted a message a few days ago about STLReader failing on a file. I have found the problem now, its not what I suspected first:

The thing that goes wrong (on Windows VS, I don't know about other systems) is this line:

  // Initialize
  //
  if ((fp = fopen(this->FileName, "r")) == NULL)

This opens the file in text mode, which causes number 26 to be interpreted as "CtrlZ" and also EOF, so if the header of an STL has 26 in it, automatic detection of the filetype will fail if all chars before this are below 127. The fix is:

  // Initialize
  //
  if ((fp = fopen(this->FileName, "rb")) == NULL)

Hope this helps...

Greetings
Gregi

PS. Maybe the other readers should be checked for this?




More information about the vtkusers mailing list