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