There is nothing in upgrading to Windows 10 that will create accent issues.
In fact since 2018 Windows 10 has the Terminal which is the right place to run console programs since then: accents, Unicode, Greek, Russian, Unicode with all possible symbols. And graphics acceleration using the graphics card. And True Color instead of 256 colors.
I didn’t understand your program. a "lot of research" you did included this address: Official documentation about the console and maybe this link, which is on every screen of Windows 10 console: new console features and that Experimental settings of the terminal
Back to your show
_locale_t _get_current_locale(void);
Whenever you run a program on the console and change something it is ethical and polite to copy the original configuration and restore on output. And that includes the locale, the code pages, the fonts and, of course, the colors. For a moment I thought I was doing this but it didn’t save anywhere so it didn’t do any good. Read the documentation on _get_current_locale()
return a _locale_t
? And what did you do to him? Nothing. He said no.
setlocale(LC_ALL, ".OCP");
That’s probably not a good idea. It’s like calling system()
to do something. If you have a problem with locale
changes the locale
. with setlocale()
. If you need a particular codepage use SetConsoleOutputCP()
and configure the page you want. Before, of course, use GetConsoleOutputCP()
and save the page in use and restore on output. Your program can make someone very upset if you don’t do this.
This command you used defines the locale
as being the one that is configured in the control panel. But you know what it is? Normal is 850 and will not serve. Why not use normal "pt_BR.UTF-8"
?
And in the program, you’re using C++, because you don’t do the simple and write
SetConsoleOutputCP(1252);
What is the normal page here in BR? Or the 65001, Unicode?
What do you want with
rewind(stdin);
It almost never works. You’re reading from the keyboard.
letra = _getche();
What’s the point? The IDE already stops by itself at the end of the program. This routine is from the 1980s. It’s compiling a header
derived from a Borland library, from the 1980s, only to read a fine print? Don’t need this.
system("cls");
And system()
to clear the screen is little useful because as soon as you type something in the IDE it will close the window so it makes no difference whether you cleaned the screen or not. And this routine is banned and persecuted in many places for security reasons.
An implementation of cls() in the official
int cls()
{ // limpa a tela no windows, do jeito oficial
CONSOLE_SCREEN_BUFFER_INFO info;
HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
COORD origem = { 0,0 };
int total;
if (H == INVALID_HANDLE_VALUE) return -1;
GetConsoleScreenBufferInfo(H, &info);
int r = FillConsoleOutputCharacter(H, (TCHAR)' ',
info.dwSize.X * info.dwSize.Y,
origem, &total);
int s = FillConsoleOutputAttribute(
H, info.wAttributes,
info.dwSize.X * info.dwSize.Y,
origem, &total);
SetConsoleCursorPosition(H, origem);
return 0;
}; // end cls()
Normal console programs in Windows: takes a Handle to access the window, sees the color and font in use, and clears all buffer --- default is 9001 lines in Windows for decades --- and then puts the cursor at the beginning of the screen