convert a string to a double representation
#include <stdlib.h> double atof( const char *ptr );
The atof() function converts the string pointed to by ptr to double representation. It's equivalent to
strtod( ptr, (char **)NULL )
When an error has occurred, errno contains a value indicating the type of error that has been detected.
#include <stdlib.h>
void main()
{
double x;
x = atof( "3.1415926" );
}
ANSI
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |