当朝鲜语的路径,打开文件错误 [英] When the path of Korean, open file error
本文介绍了当朝鲜语的路径,打开文件错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当朝鲜语的路径时,打开文件错误:
When the path of Korean, open file error:
int mMinSize;
string mstrReturn;
char *mcharReturn;
const wchar_t *mchar;
ifstream mstream;
wchar_t *mwchar = _T("D:\\kankan\\한국어\\MultiLanguage.dat");
mMinSize = WideCharToMultiByte(CP_ACP, NULL, mwchar, -1, NULL, 0, NULL, FALSE);
mcharReturn = new char[mMinSize + 1];
WideCharToMultiByte(CP_ACP, NULL, mwchar, -1, mcharReturn, mMinSize * 2, NULL, FALSE);
mstream.open(mcharReturn, ios::binary);
if (!mstream)
{
//error mcharReturn = "D:\\kankan\\???\\MultiLanguage.dat"
return 0;
}
推荐答案
MS文件流类支持wchar
文件自Visual Studio 2005以来的名称。使用这些名称时只需传递宽字符文件名。
使用较旧的VS版本使用支持宽字符文件名的不同文件访问方法(例如,带有CreateFileW
的Windows API或带有_wfopen
的C库。)
The MS file stream classes supportwchar
file names since Visual Studio 2005. Just pass the wide char file name when using these.
With older VS versions use a different file access method that supports wide char file names (e.g. the Windows API withCreateFileW
or the C library with_wfopen
).
这篇关于当朝鲜语的路径,打开文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文