|
65 | 65 | BYUMeshIO::ReadMeshInformation() |
66 | 66 | { |
67 | 67 | // Define input file stream and attach it to input file |
68 | | - std::ifstream inputFile; |
69 | | - |
70 | | - // Due to the windows couldn't work well for tellg() and seekg() for ASCII mode, hence we |
71 | | - // open the file with std::ios::binary |
72 | | - inputFile.open(this->m_FileName.c_str(), std::ios::in | std::ios::binary); |
73 | | - |
74 | | - if (!inputFile.is_open()) |
75 | | - { |
76 | | - itkExceptionMacro("Unable to open input file " << this->m_FileName); |
77 | | - } |
| 68 | + std::ifstream inputFile = MeshIOBase::OpenInputFile(); |
78 | 69 |
|
79 | 70 | // Read the ASCII file information |
80 | 71 | unsigned int numberOfParts = 0; |
@@ -183,16 +174,7 @@ void |
183 | 174 | BYUMeshIO::ReadPoints(void * buffer) |
184 | 175 | { |
185 | 176 | // Define input file stream and attach it to input file |
186 | | - std::ifstream inputFile; |
187 | | - |
188 | | - /** Due to the windows couldn't work well for tellg() and seekg() for ASCII mode, hence we |
189 | | - open the file with std::ios::binary */ |
190 | | - inputFile.open(this->m_FileName.c_str(), std::ios::in | std::ios::binary); |
191 | | - |
192 | | - if (!inputFile.is_open()) |
193 | | - { |
194 | | - itkExceptionMacro("Unable to open input file " << this->m_FileName); |
195 | | - } |
| 177 | + std::ifstream inputFile = MeshIOBase::OpenInputFile(); |
196 | 178 |
|
197 | 179 | // Set the position to points start |
198 | 180 | inputFile.seekg(m_FilePosition, std::ios::beg); |
@@ -221,14 +203,7 @@ void |
221 | 203 | BYUMeshIO::ReadCells(void * buffer) |
222 | 204 | { |
223 | 205 | // Define input file stream and attach it to input file |
224 | | - std::ifstream inputFile; |
225 | | - |
226 | | - inputFile.open(this->m_FileName.c_str(), std::ios::in | std::ios::binary); |
227 | | - |
228 | | - if (!inputFile.is_open()) |
229 | | - { |
230 | | - itkExceptionMacro("Unable to open input file " << this->m_FileName); |
231 | | - } |
| 206 | + std::ifstream inputFile = MeshIOBase::OpenInputFile(); |
232 | 207 |
|
233 | 208 | // Set the position to current position |
234 | 209 | inputFile.seekg(m_FilePosition, std::ios::beg); |
|
0 commit comments