C examples for wchar.h:wcstof
function
<cwchar> <wchar.h>
Convert wide string to float
float wcstof (const wchar_t* str, wchar_t** endptr);
Parameter | Description |
---|---|
str | C wide string |
endptr | the next character in str after the numerical value. |
On success, the function returns the converted number as a value of type float.
For non valid conversion, the function returns zero.
For out of range value, a positive or negative HUGE_VALF is returned, and errno is set to ERANGE.
#include <wchar.h> int main ()/* w w w . ja v a 2 s . c om*/ { wchar_t str[] = L"123686.97 12365.24"; wchar_t * pEnd; double d1, d2; d1 = wcstof (str,&pEnd); d2 = wcstof (pEnd,NULL); wprintf (L"%f\n", d1); wprintf (L"%f\n", d2); return 0; }