Salome HOME
Add test for .mesh file format
[tools/medcoupling.git] / src / MEDLoader / SauvReader.cxx
index 931d35255e85cbfe3731da16330b557450a710b1..f2a64fffff631bf83bfb8ba4f378119f079f97da 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -38,6 +38,24 @@ using namespace std;
 
 #define GIBI_EQUAL(var_str, stat_str) (strncmp (var_str, stat_str, strlen(stat_str)) == 0)
 
+namespace
+{
+  class Localizer
+  {
+    std::string _locale;
+  public:
+    Localizer()
+    {
+      _locale = setlocale(LC_NUMERIC, NULL);
+      setlocale(LC_NUMERIC, "C");
+    }
+    ~Localizer()
+    {
+      setlocale(LC_NUMERIC, _locale.c_str());
+    }
+  };
+}
+
 //================================================================================
 /*!
  * \brief Creates a reader of a given sauve file
@@ -114,6 +132,8 @@ std::string SauvReader::lineNb() const
 
 MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS()
 {
+  Localizer loc; // localization, to read numbers in "C" locale
+
   SauvUtilities::IntermediateMED iMed; // intermadiate DS
   _iMed = &iMed;