Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comma as decimal point and strtod 1

Status
Not open for further replies.

dickiebird

Programmer
Feb 14, 2002
758
GB
Guys
I'm 'freading' a text file, into database tables via embedded SQL.
But.......
The numerics on the flatfile use commas for decimal points
so sscanf only picks up the mantissa, as does strtod
Any thoughts ?????
Thanks in advance
DickieBird
 
try this...

grab the "number" as a string (i.e. 132,45) into a buffer (buff)
then use...
s = strpbrk(buff, ",");
*s = '.';

...now convert "buff" into a float with sscanf or strtod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top