Changeset 11096 in ntrip for trunk/BNC/src/pppCrdFile.cpp


Ignore:
Timestamp:
Oct 16, 2026, 3:37:24 PM (2 hours ago)
Author:
stuerze
Message:

minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/pppCrdFile.cpp

    r11027 r11096  
    4343#include <cstdlib>
    4444#include <fstream>
     45#include <locale>
    4546#include <sstream>
    4647#include "pppCrdFile.h"
    … …  
    6364  double sign = (d < 0.0) ? -1.0 : 1.0;
    6465  return sign * (fabs(d) + m / 60.0 + s / 3600.0);
     66}
     67
     68// Convert a number token independent of the process locale: atof() follows
     69// LC_NUMERIC, which Qt sets from the environment, so with e.g. a German
     70// locale "123.7785" would be read as 123.
     71//////////////////////////////////////////////////////////////////////////////
     72static double toDouble(const string& str) {
     73  istringstream in(str);
     74  in.imbue(locale::classic());
     75  double value = 0.0;
     76  in >> value;
     77  return value;
    6578}
    6679
    … …  
    133146      }
    134147      else if (token.compare(0, 2, "H:") == 0) {
    135         hgt = atof(token.substr(2).c_str());
     148        hgt = toDouble(token.substr(2));
    136149        haveHgt = true;
    137150      }
    138151      else if (token.compare(0, 6, "EPOCH:") == 0) {
    139         staInfo._epoch = atof(token.substr(6).c_str());
     152        staInfo._epoch = toDouble(token.substr(6));
    140153      }
    141154      else if (token.compare(0, 4, "VEL:") == 0) {
Note: See TracChangeset for help on using the changeset viewer.