This shows you the differences between two versions of the page.
c:stdlib.h:mbtowc [2013/01/22 22:02] 127.0.0.1 external edit |
c:stdlib.h:mbtowc [2024/02/16 01:04] (current) |
||
---|---|---|---|
Line 27: | Line 27: | ||
wchar_t wchar; | wchar_t wchar; | ||
char string[] = "mbtowc: 測試字符串"; | char string[] = "mbtowc: 測試字符串"; | ||
- | int i=0, lenght=0; | + | int i=0, length=0; |
setlocale(LC_ALL,""); | setlocale(LC_ALL,""); | ||
- | while ( ( lenght = mbtowc ( &wchar, &string[i], MB_CUR_MAX )) != 0) | + | while ( ( length = mbtowc ( &wchar, &string[i], MB_CUR_MAX )) != 0) |
{ | { | ||
printf( "%lc", (wint_t)wchar ); | printf( "%lc", (wint_t)wchar ); | ||
- | // printf("i=%i, lenght=%i\n",i, lenght); | + | // printf("i=%i, length=%i\n",i, length); |
- | i += lenght; | + | i += length; |
} | } | ||
printf("\n"); | printf("\n"); |