Guardian C Library Calls Reference Manual
atof
3-10 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
atof
The atof function converts a string to a value of type double. 
str_ptr
points to the string to convert.
Return Value
is the floating-point value of the string *str_ptr, expressed as a double value. atof 
returns a value of zero if the first nonspace character in *str_ptr is not a sign, a 
decimal digit, or a decimal point.
Usage Guidelines
•
The atof function begins the conversion by skipping any leading space characters (as 
defined by the isspace function) in *str_ptr. It then scans for a valid floating-point 
constant, continuing until it encounters an invalid character or the null character 
terminating the string.
Example
This example converts the string “1.34” to a floating-point number:
#include <stdlibh>
int main(void)
{
 char *string;
 double num;
 string = "1.34";
 num = atof(string);
}
#include <stdlibh>
double atof(const char *str_ptr);










