wcstold - C wchar.h

C examples for wchar.h:wcstold

Type

function

From


<cwchar>
<wchar.h>

Description

Convert wide string to long double

Prototype

long double wcstold (const wchar_t* str, wchar_t** endptr);

Parameters

Parameter Description
str C wide string
endptr the next character in str after the numerical value.

Return 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.

Demo Code


#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;
}

Related Tutorials