#include <stdio.h>
#include <stdlib.h>
#define BUFFER_SIZE 50
int main () {
size_t ret;
char *MB = (char *)malloc( BUFFER_SIZE );
wchar_t *WC = L"https://www.yiibai.com";
/* converting wide-character string */
ret = wcstombs(MB, WC, BUFFER_SIZE);
printf("Characters converted = %u/n", ret);
printf("Multibyte character = %s/n/n", MB);
return(0);
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/265257.html