#include <wchar.h>
|
|
float
wcstof (const wchar_t * restrict src, wchar_t ** restrict endptr); |
|
long double
wcstold (const wchar_t * restrict src, wchar_t ** restrict endptr); |
|
double
wcstod (const wchar_t * restrict src, wchar_t ** restrict endptr); |
#include <wchar.h>
/* Illustrates how to use wcstof API */
int example_wcstof()
{
/* src string */
wchar_t wcs1[21] = L" 1.23abcd";
wchar_t wcs2[5]=L"abcd";
wchar_t *eptr;
float d;
/* convert wide-char string to float */
d = wcstof(wcs1, &eptr);
/* compare the result */
if((d == 1.23F) && !(wcscmp (eptr, wcs2)))
return 0;
else
return 1;
}
#include <wchar.h>
/* Illustrates how to use wcstold API */
int example_wcstold()
{
/* src string */
wchar_t wcs1[21] = L" 1.23abcd";
wchar_t wcs2[5]=L"abcd";
wchar_t *eptr;
double d;
/* convert wide-char string to double */
d = wcstod(wcs1, &eptr);
/* compare the result */
if((d == 1.23) && !(wcscmp (eptr, wcs2)))
return 0;
else
return 1;
}
#include <wchar.h>
/* Illustrates how to use wcstold API */
int example_wcstold()
{
/* src string */
wchar_t wcs1[21] = L" 1.23abcd";
wchar_t wcs2[5]=L"abcd";
wchar_t *eptr;
long double d;
/* convert wide-char string to long double */
d = wcstold(wcs1, &eptr);
/* compare the result *
if((d == 1.23) && !(wcscmp (eptr, wcs2)))
return 0;
else
return 1;
}
The wcstof, wcstod and wcstold functions conform to -isoC-99.
|
© 2005-2007 Nokia |