[vtkusers] vtkXMLWriter: How can I catch write errors?

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon May 25 10:05:48 EDT 2009


Writers typically set the ErrorCode on error. Check the value returned by
GetErrorCode() for errors and details about the errors.

Utkarsh

On Mon, May 25, 2009 at 10:01 AM, Mike Taverne <mtaverne at engits.com> wrote:

> Hi,
>
> I'm using vtkXMLUnstructuredGridWriter and noticed that when I call the
> "Write" method, it always returns 1, even if writing to the file failed
> because of permission problems or a non-existent path.
> An error code does show up in the terminal, but how can I catch it in my
> code?
>
> Here's the Write method, which seems to only return 0 when no input is
> provided:
> ================
> int vtkXMLWriter::Write()
> {
>  // Make sure we have input.
>  if (this->GetNumberOfInputConnections(0) < 1)
>    {
>    vtkErrorMacro("No input provided!");
>    return 0;
>    }
>
>  // always write even if the data hasn't changed
>  this->Modified();
>
>  this->Update();
>  return 1;
>
> }
>
> ================
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090525/7d5d2027/attachment.htm>


More information about the vtkusers mailing list