------------------------------------------------------------------------------
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | int vtkEnSight6BinaryReader::OpenFile(const char* filename) |
| 61 | { |
| 62 | if (!filename) |
| 63 | { |
| 64 | vtkErrorMacro(<< "Missing filename."); |
| 65 | return 0; |
| 66 | } |
| 67 | |
| 68 | delete this->BinaryIFile; |
| 69 | this->BinaryIFile = nullptr; |
| 70 | |
| 71 | // Open the new file |
| 72 | vtkDebugMacro(<< "Opening file " << filename); |
| 73 | VTK_STAT_STRUCT fs; |
| 74 | if (!VTK_STAT_FUNC(filename, &fs)) |
| 75 | { |
| 76 | // Find out how big the file is. |
| 77 | this->FileSize = static_cast<vtkTypeUInt64>(fs.st_size); |
| 78 | |
| 79 | std::ios_base::openmode mode = ios::in; |
| 80 | #ifdef _WIN32 |
| 81 | mode |= ios::binary; |
| 82 | #endif |
| 83 | this->BinaryIFile = new vtksys::ifstream(filename, mode); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | vtkErrorMacro("stat failed."); |
| 88 | return 0; |
| 89 | } |
| 90 | if (!this->BinaryIFile || this->BinaryIFile->fail()) |
| 91 | { |
| 92 | vtkErrorMacro(<< "Could not open file " << filename); |
| 93 | return 0; |
| 94 | } |
| 95 | return 1; |
| 96 | } |
| 97 | |
| 98 | //------------------------------------------------------------------------------ |
| 99 | int vtkEnSight6BinaryReader::ReadGeometryFile( |
no outgoing calls
no test coverage detected