ASCII - FLOAT conversion | Cypress Semiconductor
ASCII - FLOAT conversion
I am having a problem with using the library function "atof". The compiler user guide describes the function as one which takes a pointer to a NULL terminated string as the argument and returns a double value.
Now what I have done is this. I have a program that creates a formatted string when user inputs each character of the string one by one by incrementing an initial character pointer (say *strptr) and finally giving a carriage return which is written as '\0' (NULL) in the last location of a string. The intial value of the character pointer is stored in another pointer variable.(say *ptrval, as in ptrval=strptr when program is initiated).
now to convert the ascii charater string that has been created in the previous sequence into a double value I use the function atof( ). eg. cval=atof(ptrval);
the variable 'cval' is monitored in the watch window. but it is not at all getting updated. please help me find out what could be wrong? is the way I have specified the argument correct? the compiler does not provide quality information on this.
Danke Amigos. :)