I have a simple code and argv[1]
is "Привет"
.
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <locale.h>
int _tmain(int argc, TCHAR* argv[])
{
TCHAR buf[100];
_fgetts(buf, 100, stdin);
_tprintf(TEXT("\nargv[1] %s\n"), argv[1]);
_tprintf(TEXT("%s\n"), buf);
}
In the console, I write "Мир"
and have this result:
If I use setlocale(LC_ALL, "")
, I have this result:
What should I do to get the correct string in both cases?