Name
wcstod, wcstof, wcstold
Synopsis
Converts a wide string into a floating-point number
#include <wchar.h> doublewcstod( const wchar_t * restrictwcs, wchar_t ** restrictendptr); floatwcstof( const wchar_t * restrictwcs, wchar_t ** restrictendptr); (C99) long doublewcstold( const wchar_t * restrictwcs, wchar_t ** restrictendptr); (C99)
The wcstod() function
attempts to interpret the wide string addressed by its first pointer
argument, wcs, as a floating-point
numeric value, and returns the result with the type double. wcstof() and wcsold() are similar, but return float and long
double respectively. Leading whitespace wide characters
are ignored, and the string converted ends with the last wide
character that can be interpreted as part of a floating-point
numeral. The second parameter, endptr, is
a pointer to a pointer. If its argument value is not a null pointer,
then the function stores a pointer to the first wide character that
is not part of the numeral converted in the location addressed by
the endptr argument. (The locations that
the function reads from and writes to using its restricted pointer
parameters must not overlap.) If no conversion is possible, the
function returns 0.
If the resulting value exceeds the range of the function’s
type, then the return value is positive or negative HUGE_VAL (or HUGE_VALF or HUGE_VALL, for the float and long
double variants). On an overflow, the errno variable is set to the value of
ERANGE (“range error”). If the conversion produces ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access