Converts a given wide-character string to a double-precision number.
Format
#include <wchar.h>
double wcstod (const wchar_t *nptr, wchar_t
**endptr);
Arguments
- nptr
- A pointer to the wide-character string to be converted to a
double-precision number.
- endptr
- The address of an object where the function can store the
address of the first unrecognized wide character that terminates
the scan. If endptr is a NULL pointer, the address of the
first unrecognized wide character is not retained.
Description
This function recognizes an optional sequence of white-
space characters (as defined by iswspace), then an optional plus
or minus sign, then a sequence of digits optionally containing a
radix character, then an optional letter (e or E) followed by an
optionally signed integer. The first unrecognized character ends the
conversion.
The string is interpreted by the same rules used to interpret
floating constants.
The radix character is defined in the program's current locale
(category LC_NUMERIC).
This function returns the converted value. For wcstod, overflows are
accounted for in the following manner:
- If the correct value causes an overflow, HUGE_VAL (with
a plus or minus sign according to the sign of the value) is
returned and errno is set to ERANGE.
- If the correct value causes an underflow, 0 is returned
and errno is set to ERANGE.
If the string starts with an unrecognized wide character,
*endptr is set to nptr and a 0 value is returned.
Return Values
x | The converted string. |
0 | Indicates the conversion could not
be performed. The function sets errno to one of:
- EINVAL - No conversion could be performed.
- ERANGE - The value would cause an underflow.
- ENOMEM - Not enough memory available for internal
conversion buffer.
|
(+/ -)HUGE_VAL | Indicates
overflow. The function sets errno to ERANGE. |
Previous Page | Next Page | Table of Contents | Index