strtod()

Syntax

  #include <stdlib.h>


  
  double strtod(const char *s, char **end);

  
Description

strtod() converts string s into a floating point number, skipping over any white space at the beginning of s. It stops scanning when it reaches a character not matching the required syntax and returns a pointer to that character in *end. strtod() accepts the following number format:

FloatNum = Sign{Digit}[.{Digit}][Exp]

Sign = [+|-]

Exp = (e|E)SignDigit{Digit}

Digit = <any decimal digit from 0 to 9>

Return

The floating point number read. If an underflow occurred, strtod() returns 0.0. If the value causes an overflow, strtod() returns HUGE_VAL. In both cases, strtod() sets errno to ERANGE.

See also

atof()

scanf()

strtol()

strtoul()