C examples for wchar.h:wcstold
function
<cwchar> <wchar.h>
Convert wide string to long double
long double wcstold (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, it returns the converted number as a value of type long double.
For non valid conversion, the function returns zero.
For out of range value, a positive or negative HUGE_VALL is returned, and errno is set to ERANGE.
#include <wchar.h> int main ()//w w w . ja va 2s .co m { wchar_t str[] = L"12345.655 325.24"; wchar_t * pEnd; long double f1, f2; f1 = wcstold (str,&pEnd); f2 = wcstold (pEnd,NULL); wprintf (L"%Lf .\n", f1); wprintf (L"%Lf .\n", f2); return 0; }