mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 11:54:00 +02:00
Fix for different locale's
This commit is contained in:
@@ -35,6 +35,7 @@ bool strToBool(const string &s){
|
|||||||
|
|
||||||
int strToInt(const string &s){
|
int strToInt(const string &s){
|
||||||
char *endChar;
|
char *endChar;
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
int intValue= strtol(s.c_str(), &endChar, 10);
|
int intValue= strtol(s.c_str(), &endChar, 10);
|
||||||
|
|
||||||
if(*endChar!='\0'){
|
if(*endChar!='\0'){
|
||||||
@@ -47,6 +48,8 @@ int strToInt(const string &s){
|
|||||||
|
|
||||||
float strToFloat(const string &s){
|
float strToFloat(const string &s){
|
||||||
char *endChar;
|
char *endChar;
|
||||||
|
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
float floatValue= static_cast<float>(strtod(s.c_str(), &endChar));
|
float floatValue= static_cast<float>(strtod(s.c_str(), &endChar));
|
||||||
|
|
||||||
if(*endChar!='\0'){
|
if(*endChar!='\0'){
|
||||||
@@ -71,6 +74,8 @@ bool strToBool(const string &s, bool *b){
|
|||||||
|
|
||||||
bool strToInt(const string &s, int *i){
|
bool strToInt(const string &s, int *i){
|
||||||
char *endChar;
|
char *endChar;
|
||||||
|
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
*i= strtol(s.c_str(), &endChar, 10);
|
*i= strtol(s.c_str(), &endChar, 10);
|
||||||
|
|
||||||
if(*endChar!='\0'){
|
if(*endChar!='\0'){
|
||||||
@@ -81,6 +86,7 @@ bool strToInt(const string &s, int *i){
|
|||||||
|
|
||||||
bool strToFloat(const string &s, float *f){
|
bool strToFloat(const string &s, float *f){
|
||||||
char *endChar;
|
char *endChar;
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
*f= static_cast<float>(strtod(s.c_str(), &endChar));
|
*f= static_cast<float>(strtod(s.c_str(), &endChar));
|
||||||
|
|
||||||
if(*endChar!='\0'){
|
if(*endChar!='\0'){
|
||||||
|
Reference in New Issue
Block a user