Last active
November 17, 2023 15:28
-
-
Save proffix4/11fda97f7b4c49d0c32e39a75e971ea8 to your computer and use it in GitHub Desktop.
Русские буквы в C++ для Unicode-строк wxWidgets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <wx/wx.h> | |
int main(int argc, char** argv) | |
{ | |
wxLocale m_locale; // Создать объект локали для wxWidgets | |
m_locale.Init(wxLANGUAGE_RUSSIAN, wxLOCALE_DONT_LOAD_DEFAULT); // Установить локаль для wxWidgets | |
#ifdef __WXMSW__ // Определение для Windows | |
SetConsoleCP(1251); // Установить кодовую страницу ввода для Windows | |
SetConsoleOutputCP(1251); // Установить кодовую страницу вывода для Windows | |
#elif __WXGTK__ // Определение для Linux | |
wxPuts(wxT("Замечательно! Das ist großartig! Wonderful! 精彩的! رائع!")); // Вывести строку | |
#endif | |
std::wstring input; // Создать строковую переменную | |
wxPuts(wxT("Как вас зовут?")); // Вывести строку | |
std::wcin >> input; // Считать строку | |
wxString result(input); // Создать строку | |
wxPuts(L"Привет," + result + "!"); // Вывести строку | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment