#include <wchar.h>
|
size_t
wcsxfrm (wchar_t * restrict dst, const wchar_t * restrict src, size_t n); |
Comparing two strings using wcscmp after wcsxfrm is equivalent to comparing two original strings with wcscoll.
#include <stdlib.h> #include <wchar.h> /* Illustrates how to use wcpcpy API */ int example_wcpcpy() { /* input string for which length to be found */ wchar_t *src = L"testcase"; wchar_t *dest = NULL; int length; /* allocate memory for the destination string */ dest = (wchar_t *)malloc((wcslen(src)+1)*sizeof(wchar_t)); /* perform the operation */ if(dest != NULL) length = wcsxfrm(dest,src,9); else { wprintf(L"ERROR : Cannot allocate memory"); return -1; } return length; }
Comparing two strings using wcscmp after wcsxfrm is not always equivalent to comparison with wcscoll; wcsxfrm only stores information about primary collation weights into dst, whereas wcscoll compares characters using both primary and secondary weights.
© 2005-2007 Nokia |