私はC言語を学びます。Unicodeデータを使用してテキストファイルを作成する必要があります。私はそのようなコードを書きました:
#include<stdio.h>
#include<stdlib.h>
#include<wchar.h>
int main(int argc, char *argv[]) {
wchar_t *s1 = L"Привет, мир!\n";
wchar_t *s2 = L"Hello, World!";
FILE *fp = fopen("./hello.txt", "w");
fputws(s1, fp);
fputws(s2, fp);
fclose(fp);
exit(EXIT_SUCCESS);
}
しかし、私はそのような結果を得ます:
??????, ???!
Hello, World!
なぜ私はロシアの文字を取得しないのですか?