fork download
  1. #include <stdio.h>
  2. #include <locale.h>
  3. #include <wchar.h>
  4.  
  5. int main() {
  6. // Set the locale (try different locale strings if needed)
  7. if (setlocale(LC_ALL, "zh_CN.UTF-8"));
  8.  
  9. wchar_t chineseName;
  10. wprintf(L"请输入您的中文名字:");
  11. fgetws(chineseName, 50, stdin);
  12. wprintf(L"您输入的名字是:%ls\n", chineseName);
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
?????????:???????:(null)