Salome HOME
Fix of 0022218: EDF 2638 SMESH: Issue when importing UNV file:
[modules/smesh.git] / src / DriverUNV / UNV_Utilities.hxx
index 1e0f42f5b57eadc8eb50c417b492455fa47c41db..1db6d2bb9c68e866fc3a52a51947a1ceb4f734e4 100644 (file)
@@ -36,7 +36,7 @@
 namespace UNV{
   using namespace std;
 
-  const size_t theMaxLineLen = 80;
+  const size_t theMaxLineLen = 82; // 80 for text + 2 for "\r\n"
 
   class MESHDRIVERUNV_EXPORT PrefixPrinter{
     static int myCounter;
@@ -128,15 +128,14 @@ namespace UNV{
    */
   inline std::string read_line(std::ifstream& in_stream, const bool next=true)
   {
-    char line[theMaxLineLen];
-    in_stream.getline( line, theMaxLineLen );
+    std::string resLine;
+    std::getline( in_stream, resLine );
     if ( next )
-      in_stream.getline( line, theMaxLineLen );
+      std::getline( in_stream, resLine );
 
-    std::string resLine = line;
     if ( resLine.size() > 0 && resLine[ resLine.size()-1 ] == '\r' )
       resLine.resize( resLine.size()-1 );
-    return line;
+    return resLine;
   }
 };