Программа некоректно записывает русские буквы, но считывает правильно записанный в ручную в файл русский текст
`int main() { setlocale(LC_ALL, "russ");
string path;
path = "myFile.txt";
fstream fs;
fs.open(path, fstream::in| fstream::out| fstream::app);
if (!fs.is_open())
{
cout << "File is not open!!!" << endl;
}
else
{
SetConsoleCP(1251);
cout << "File is open!!!" << endl;
int value;
string Mesege;
cout << "Нажмите 1 для записи в файл." << endl;
cout << "Нажмите 2 для считывания из файла." << endl;
cin >> value;
if (value==1)
{
cout << "Введите сообщение!" << endl;
cin >> Mesege;
fs << Mesege << endl;
}
if (value == 2)
{
while (!fs.eof())
{
Mesege = "";
getline(fs,Mesege);
cout << Mesege << endl;
}
}
if (value != 1 && value != 2)
{
cout << "Error choose" << endl;
}
SetConsoleCP(866);
}
fs.close();
return 0;
}
`