long double wcstold (const wchar_t* str, wchar_t** endptr);
Convert wide string to long double
Parses the C wide string str interpreting its content as a floating point number and returns its value as a long double. If endptr is not a null pointer, the function also sets the value of endptr to point to the first character after the number.
This is the wide character equivalent of strtold (<cstdlib>), interpreting str in the same way.
- C wide string beginning with the representation of a floating-point number.
- Reference to an already allocated object of type wchar_t*, whose value is set by the function to the next character in str after the numerical value.
This parameter can also be a null pointer, in which case it is not used.
On success, the function returns the converted floating point number as a value of type long double.
If no valid conversion could be performed, the function returns zero (0.0L).
If the correct value is out of the range of representable values for the type, a positive or negative HUGE_VALL is returned, and errno is set to ERANGE.
If the correct value would cause underflow, the function returns a value whose magnitude is no greater than the smallest normalized positive number (some library implementations may also set errno to ERANGE in this case).
/* wcstold example */
int main ()
wchar_t szOrbits = L"90613.305 365.24";
wchar_t * pEnd;
long double f1, f2;
f1 = wcstold (szOrbits,&pEnd);
f2 = wcstold (pEnd,NULL);
wprintf (L"Pluto takes %.2Lf years to complete an orbit.\n", f1/f2);
Pluto takes 248.09 years to complete an orbit.
- Convert string to long double (function)
- Convert wide string to double (function)
- Convert wide string to long integer (function)