[vtkusers] File Type Verification in Batch (Weird Problem)

David Doria daviddoria at gmail.com
Mon Oct 29 21:38:52 EDT 2012


On Mon, Oct 29, 2012 at 9:22 PM, matheus_viana <vianamp at gmail.com> wrote:
> Hi Guys!
>
> I wanna check the file format of a set of .vtk files. They can be either
> StructuredPoints or PolyData files.
>
> So, I wrote this simple code:
>
> for (i = 0; i < 200; i++) {
>         vtkSmartPointer<vtkDataReader> Reader =
> vtkSmartPointer<vtkDataReader>::New();
>         Reader -> SetFileName(filename[i].c_str());
>         Reader -> OpenVTKFile();
>         if (Reader->IsFileStructuredPoints()) {
>                 TYPE[i] = 0;
>         } else {
>                 TYPE[i] = 1;
>         }
>         Reader -> CloseVTKFile();
> }
>
> The program always crashes when i = 46. No problems with the file names.
>
> Do you guys have any idea?
>
> Thanks in advance,
> Matheus

You have not shown how you have allocated TYPE. You also have not
shown how long the filename array is. I would suggest stepping through
with a debugger to see where it crashes - that might give you a hint
as to what is wrong.

David



More information about the vtkusers mailing list