[vtkusers] vtkXMLWriter: How can I catch write errors?
    Mike Taverne 
    mtaverne at engits.com
       
    Mon May 25 10:01:54 EDT 2009
    
    
  
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;
}
================
    
    
More information about the vtkusers
mailing list