- ensure locale is properly set when converting numbers
This commit is contained in:
parent
c86c506c2d
commit
d8f4c69a01
|
@ -117,12 +117,16 @@ string intToHex(int i){
|
|||
}
|
||||
|
||||
string floatToStr(float f,int precsion) {
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
char str[strSize]="";
|
||||
snprintf(str, strSize-1, "%.*f", precsion,f);
|
||||
return (str[0] != '\0' ? str : "");
|
||||
}
|
||||
|
||||
string doubleToStr(double d,int precsion) {
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
|
||||
char str[strSize]="";
|
||||
snprintf(str, strSize-1, "%.*f", precsion,d);
|
||||
return (str[0] != '\0' ? str : "");
|
||||
|
|
Loading…
Reference in New Issue
Block a user