atof

Converts a string to double representation

Local Servers:nonblocking
Remote Servers:N/A
Classification:ANSI
Service:String Conversion

Syntax

  #include <stdlib.h>  
   
  double atof  (  
     const char   *ptr);
  

Parameters

ptr
(IN) Points to the string to be converted.

Return Values

atof returns the converted value. A value of 0 is returned when the input string cannot be converted. When an error has occurred, errno is set

Remarks

The atof function converts the string pointed to by ptr to double representation.

See Also

sscanf, strtod

Example

  #include <stdlib.h>  
   
  main ()  
  {  
     double x;  
     x=atof("3.1415926");  
  }