#include <wchar.h>
|
|
wchar_t *
wcpncpy (wchar_t *dest , const wchar_t *src, size_t n); |
#include <stdlib.h>
#include <wchar.h>
/* Illustrates how to use wcpncpy API */
int example_wcpncpy(void)
{
/* input string for which length to be found */
wchar_t *src = L"testcase";
wchar_t *dest = NULL;
wchar_t *destEndPtr = NULL;
/* allocate memory for the destination string */
dest = (wchar_t *)malloc((wcslen(src)+1)*sizeof(wchar_t));
/* perform the operation */
if(dest != NULL)
destEndPtr = (wchar_t *)wcpncpy(dest,src,wcslen(src)+1);
else
return -1;
/* checking for error */
if(!wcscmp(dest,src))
{
wprintf(L"wcpncpy succeeded\n");
free(dest);
return 0;
}
else
{
wprintf(L"wcpncpy failed!!\n");
free(dest);
return -1;
}
}
|
© 2007-2009 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|