1 int main(void)
2 {
3 char *s = setlocale(LC_ALL,"zh_CN.utf8");
4 // printf("%s \n",s);
5 if (NULL == s)
6 {
7
8 printf("Your system does not support Chinese.\n");
9
10 } else {
11
12 wchar_t wa[] = L"中国北京";
13 wchar_t *wpi;
14 wchar_t wc = L'';
15
16 wpi = wcschr( wa, wc );
17 printf( "在 %ls 中找到了字符 '%lc' \n",wa,*wpi );
18
19 }
20
21 return 0;
22 }


输出

在 中国北京 中找到了字符 '北'

  • ubuntu系统默认语言英文,安装了中文包

相关文章:

  • 2022-12-23
  • 2021-11-24
  • 2021-10-02
  • 2021-11-01
  • 2021-06-12
  • 2021-07-29
  • 2021-04-10
猜你喜欢
  • 2021-10-17
  • 2021-11-14
  • 2021-11-09
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案