读书人

中文路径有关问题

发布时间: 2012-04-21 14:34:44 作者: rapoo

中文路径问题
GDAL库中的一个函数GDALOpen(const char * pszFilename,GDALAccess eAccess);


GDALOpen("c:\\test.tif",GA_ReadOnly);//可正常执行

但是路径中带有中文就不能正常执行了如下

GDALOpen("c:\\复制test.tif",GA_ReadOnly);//运行时错误


函数参数的解释如下:
Parameters:
pszFilename the name of the file to access. In the case of exotic drivers this may not refer to a physical file, but instead contain information for the driver on how to access a dataset. It should be in UTF8 encoding.
eAccess the desired access, either GA_Update or GA_ReadOnly. Many drivers support only read only access.

请问有什么方法解决吗?

[解决办法]
试试下面函数,是一对:
MultiByteToWideChar
WideCharToMultiByte

读书人网 >C++

热点推荐