C
onverts a string to a double-precision floating point value.
#include <stdlib.h> double strtod(const char *nptr, char **endptr); #include <wchar.h> double wcstod(const wchar_t *nptr, wchar_t **endptr);
nptr
endptr
strtod expects nptr
to point to a string with this form:
[whitespace][sign][digits][.digits][{d|D|e|E}[sign]digits]
The first character that does not fit this form stops the scan.
If no conversion can be performed (no valid digits are found or an invalid base is specified), the value of nptr
is stored at the location pointed to by endptr
.
strtod
returns the value of the floating-point number, except when the representation would cause an overflow, in which case the function returns +/–HUGE_VAL
. The sign of HUGE_VAL
matches the sign of the value that cannot be represented. strtod
returns 0 if no conversion can be performed or an underflow occurs.
wcstod
returns values analogously to strtod
. For both functions, errno
is set to ERANGE
if overflow or underflow occurs.
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
---|---|---|
_tcstod | strtod | wcstod |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 (wide-character and generic text versions) |
intime/rt/include/stdlib.h intime/rt/include/wchar.h intime/rt/include/tchar.h |
stdlib.h wchar.h tchar.h |
clib.lib |