Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    double strtod( const char *ptr, char **endptr );

Description:
    The strtod function converts the string pointed to by ptr to double
    representation.  The function recognizes a string containing:

     *  optional white space,
     *  an optional plus or minus sign,
     *  a sequence of digits containing an optional decimal point,
     *  an optional 'e' or 'E' followed by an optionally signed sequence of
        digits.

    The conversion ends at the first unrecognized character.  A pointer to
    that character will be stored in the object to which endptr points if
    endptr is not NULL.

Returns:
    The  strtod function returns the converted value.  If the correct value
    would cause overflow, plus or minus  HUGE_VAL is returned according to
    the sign, and  errno is set to  ERANGE.  If the correct value would
    cause underflow, then zero is returned, and  errno is set to  ERANGE.
     Zero is returned when the input string cannot be converted.  When an
    error has occurred,  errno contains a value indicating the type of error
    that has been detected.

See Also:
    atof

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
      {
        double pi;

        pi = strtod( "3.141592653589793", NULL );
        printf( "pi=%17.15f\n",pi );
      }

Classification:
    ANSI

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson