MCPcopy Create free account
hub / github.com/Kitware/VTK / OpenFile

Method OpenFile

IO/XML/vtkXMLWriter.cxx:611–643  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

609
610//------------------------------------------------------------------------------
611int vtkXMLWriter::OpenFile()
612{
613 delete this->OutFile;
614 this->OutFile = nullptr;
615
616 // Strip trailing whitespace from the filename.
617 int len = static_cast<int>(strlen(this->FileName));
618 for (int i = len - 1; i >= 0; i--)
619 {
620 if (isalnum(this->FileName[i]))
621 {
622 break;
623 }
624 this->FileName[i] = 0;
625 }
626
627 std::ios_base::openmode mode = ios::out;
628#ifdef _WIN32
629 mode |= ios::binary;
630#endif
631 this->OutFile = new vtksys::ofstream(this->FileName, mode);
632 if (!this->OutFile || !*this->OutFile)
633 {
634 vtkErrorMacro("Error opening output file \"" << this->FileName << "\"");
635 this->SetErrorCode(vtkErrorCode::GetLastSystemError());
636 vtkErrorMacro(
637 "Error code \"" << vtkErrorCode::GetStringFromErrorCode(this->GetErrorCode()) << "\"");
638 return 0;
639 }
640 this->Stream = this->OutFile;
641
642 return 1;
643}
644
645//------------------------------------------------------------------------------
646int vtkXMLWriter::OpenString()

Callers 5

OpenStreamMethod · 0.95
RequestInformationMethod · 0.45
RequestDataMethod · 0.45
RequestInformationMethod · 0.45
RequestDataMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected