gpt4 book ai didi

c++ - 在 Visual Studio 2008 中输入俄语字母时出错抛出控制台

转载 作者:太空狗 更新时间:2023-10-29 21:48:02 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
I can't see the russian alpabet in Visual Studio 2008

我正在尝试从控制台以俄语字母表输入符号。这是代码

#include <iostream>
#include <windows.h>
#include <locale.h>
using namespace std;

void main(){
char c;
setlocale(LC_ALL,"rus");
cout << "Я хочу видеть это по-русски!" << endl;
cin >> c;
cout << c;
}

我输入了 'ф',但它打印了 'д'。我试着用

char buf[2];
char str[2];
str[0] = c;
str[1] = '\0';
OemToAnsi(buf, str);

但是我有

+       str 0x0015fef4 "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ф¦¦¦¦d §"    char [2]
+ buf 0x0015ff00 "¦¦¦ф¦¦¦¦d §" char [2]

然后我遇到错误运行时检查失败 #2 - 变量“str”周围的堆栈已损坏。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com