C语言库wcstombs()函数

#include stdio.h#include stdlib.h#define BUFFER_SIZE 50int main () {size_t ret;char *MB = (char *)malloc( BUFFER_SIZE );

编程学习网为您整理以下代码实例,主要实现:C语言库wcstombs()函数,希望可以帮到各位朋友。

#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);
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐