しかしuchar.hライブラリーを試しに使って引っ掛かりましたそれはprintfで出力してもwしか出力しません。
"wwゴリラハローC言語を丸々を出力するにはどうすればいいのでしょうか
環境は os :windows 10, cコンパイラー: MinGW-W64(8.1.0), ライブラリ: uchar.h, stdio.h, limits.h, stdlib.h
現在参考にしているリンク先https://www.ibm.com/support/knowledgece ... m#mbrtoc32
https://www.ibm.com/support/knowledgece ... 2rtomb.htm
*下のコードが質問に該当するコード
#include <stdio.h>
#include <stdlib.h>
#include <uchar.h>
#include <limits.h>
int main(void)
{
char input[] = "wwゴリラハローC言語";
char output[MB_LEN_MAX+1];
char32_t inp32b;
size_t mbfuncerror;
mbfuncerror = mbrtoc32(&inp32b, input, (int)(MB_LEN_MAX + 1), NULL);
if (mbfuncerror < 0){
printf("変換に失敗しました mbrtoc32()\n");
printf("エラーコード%d\n", mbfuncerror);
}
printf("%d\n",mbfuncerror);
mbfuncerror = c32rtomb(output, inp32b, NULL);
if (mbfuncerror < 0){
printf("変換に失敗しました c32rtomb()\n");
printf("エラーコード%d\n", mbfuncerror);
}
output[(int)(sizeof(output))] = '\0';
printf("%s\n", output);
}