Problem converting a char array to a float
Posted on 2006-05-04
Seems like this should be pretty simple, but I can't get it to work. Here's my code:
rply.value is a char array in a rply struct. The value of the float is 50.5, but I'm getting a value of 0.000000 after I do an atof();
t=atof(rply.value);//<<<< rply.value is a char.
printf("Value of float %f\n",t);///<<<< prints out the number above
printf("Value in string %s\n",rply.value); ///<<< prints out 50.5