float wcstof (const wchar_t* str, wchar_t** endptr);
Convert wide string to float
Parses the C wide string str interpreting its content as a floating point number and returns its value as a float. 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 strtof (<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 by the function.
On success, the function returns the converted floating point number as a value of type float.
If no valid conversion could be performed, the function returns zero (0.0F).
If the correct value is out of the range of representable values for the type, a positive or negative HUGE_VALF 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).
/* wcstof example */
int main ()
wchar_t szOrbits = L"686.97 365.24";
wchar_t * pEnd;
double d1, d2;
d1 = wcstof (szOrbits,&pEnd);
d2 = wcstof (pEnd,NULL);
wprintf (L"One martian year takes %.2f Earth years.\n", d1/d2);
One martian year takes 1.88 Earth years.
- Convert string to float (function
- Convert wide string to double (function
- Convert wide string to long integer (function