1, adding #include "locale.h" in the header file
2, in front of the file with the read:
char* old_locale = _strdup( setlocale(LC_CTYPE,NULL) );
setlocale( LC_CTYPE, "chs" );
3, after reading the file with the codes:
setlocale( LC_CTYPE, old_locale );
free( old_locale );
Reproduced in: https: //www.cnblogs.com/wang-can/p/3301889.html