#include <string.h>
|
size_t
strxfrm (char * restrict dst, const char * restrict src, size_t n); |
Comparing two strings using strcmp after strxfrm is equal to comparing two original strings with strcoll.
#include <string.h> #include <stdio.h> int main() { char src2[20] = "abc"; char dst1[20] = {’\0’}; char src1[20] = "abc"; char dst2[20] = {’\0’}; int retx1; int retx2; int retc; retx1 = strxfrm(dst1,src1,strlen(src1)); retx2 = strxfrm(dst2,src2,strlen(src2)); if((retc = strcmp(dst1,dst2))== 0) printf("Strings are same\n"); }
Output
Strings are same
The strxfrm function conforms to -isoC.
© 2005-2007 Nokia |