Merge pull request #4494 from lrineau/Mesh_3-binary_IO_CRLF_issue-GF

Mesh_3 binary I/O: allow to read a binary file with a CRLF EOL at the end of first line
This commit is contained in:
Laurent Rineau 2020-01-29 16:27:41 +01:00
commit 06b1572e4d
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ bool load_binary_file(std::istream& is, C3T3& c3t3)
return false; return false;
} }
std::getline(is, s); std::getline(is, s);
if(s != "") { if(!s.empty()) {
if(s[s.size()-1] == '\r') { // deal with Windows EOL
s.resize(s.size() - 1);
}
if(s != std::string(" ") + CGAL::Get_io_signature<C3T3>()()) { if(s != std::string(" ") + CGAL::Get_io_signature<C3T3>()()) {
std::cerr << "load_binary_file:" std::cerr << "load_binary_file:"
<< "\n expected format: " << CGAL::Get_io_signature<C3T3>()() << "\n expected format: " << CGAL::Get_io_signature<C3T3>()()