VC++ 写入保存txt文件怎么设置它的编码方式,比如我想从默认的ANSI变为U...答:std::string strUtf8(nLen, '\0');WideCharToMultiByte(CP_UTF8, 0, wstrUnicode.c_str(), -1, &strUtf8[0], nLen, NULL, NULL);最后,你可以使用fopen函数以二进制模式打开文件,然后使用fwrite函数将UTF-8编码的字符串写入文件。cpp FILE *pFile = fopen("test.txt", "wb");if (...