mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
fix loading windows line ending files in textarchive
This commit is contained in:
parent
2f4e52594e
commit
8745a12246
@ -987,6 +987,8 @@ namespace ngcore
|
|||||||
*stream >> len;
|
*stream >> len;
|
||||||
char ch;
|
char ch;
|
||||||
stream->get(ch); // '\n'
|
stream->get(ch); // '\n'
|
||||||
|
if(ch == '\r') // windows line endings -> read \n as well
|
||||||
|
stream->get(ch);
|
||||||
str.resize(len);
|
str.resize(len);
|
||||||
if(len)
|
if(len)
|
||||||
stream->get(&str[0], len+1, '\0');
|
stream->get(&str[0], len+1, '\0');
|
||||||
@ -1006,6 +1008,8 @@ namespace ngcore
|
|||||||
if(len)
|
if(len)
|
||||||
{
|
{
|
||||||
stream->get(ch); // \n
|
stream->get(ch); // \n
|
||||||
|
if(ch == '\r') // windows line endings, read \n as well
|
||||||
|
stream->get(ch);
|
||||||
stream->get(&str[0], len+1, '\0'); // NOLINT
|
stream->get(&str[0], len+1, '\0'); // NOLINT
|
||||||
}
|
}
|
||||||
str[len] = '\0'; // NOLINT
|
str[len] = '\0'; // NOLINT
|
||||||
|
Loading…
Reference in New Issue
Block a user