wcstod

Converts a wide-character string to a double value.

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <wchar.h> 
   
  double   wcstod (
     const wchar_t   *nptr,
     wchar_t        **endptr);
  

Parameters

nptr

(IN) Points to the wide-character string to be converted.

endptr

(OUT) Points to the first unrecognized character.

Return Values

If successful, returns the converted value. Otherwise, returns one of the following:

  • If the correct value causes overflow, returns plus or minus HUGE_VAL and sets errno to ERANGE. The sign of HUGE_VAL matches the sign of the value that cannot be represented.

  • If the correct value causes underflow, returns a value whose magnitude is no greater than the smallest normalized positive number and sets errno to ERANGE.

  • If no conversion can be performed, returns 0 and sets errno to EINVAL.

Remarks

The wcstod function converts the string pointed to by nptr to double representation. The function recognizes a string containing:

  • Optional whitespace characters

  • 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 is stored in the object to which endptr points if endptr is not NULL.

See Also