atof

C++ - locale-independent "atof"?

I'm parsing GPS status entries in fixed NMEA sentences, where fraction part of geographical minutes comes always after period. However, on systems where locale defines comma as decimal separator, atof function ignores period and whole fraction part. What is the best method to deal with this issue? Long/latitude string in stored in chara...

C++ error converting a string to a double

I am trying to convert a string to a double. The code is very simple. double first, second; first=atof(str_quan.c_str()); second=atof(extra[i+1].c_str()); cout<<first<<" "<<second<<endl; quantity=first/second; when trying to convert extra, the compiler throws this gem of w...

any one know how to convert a huge char array to float, very huge array, performance better than the atof/strtod/sscanf

I got a char array, a huge array char p[n] read from a txt like. //1.txt 194.919 -241.808 234.896 195.569 -246.179 234.482 194.919 -241.808 234.896 ... foo(char *p, float x, float y, float z) { } I tried to use atof, strtod, but they are real time consuming when the array is too huge, because they will call the strlen(). and the s...

Reading ASCII numbers using "D" instead of "E" for scientific notation using C

Hello, I have a list of numbers which looks like this: 1.234D+1 or 1.234D-02. I want to read the file using C. The function atof will merely ignore the D and translate only the mantissa. The function fscanf will not accept the format '%10.6e' because it expects an E instead of a D in the exponent. When I ran into this problem in Pytho...

Scanning, Checking, Converting, Copying values ... How to ? -- C --

Hi there, Its been a while now and im still trying to get a certain code to work. I asked some question about different commands etc. before, but now I hope this is the final one (combining all questions in one code). I basically want to : *Scan an input (should be character ? ) *Check if its a number *If not, return error *Convert...