开发者

WinAPI CIniFile::ReadFile() can't read ini file

IDE: VS2005

Is there anyway to know why ReadFile() failed? I can't find the reason some of the INI can't be read. Thanks.

EDIT:

CIniFile i开发者_如何学JAVAniFile;
iniFile.SetPath( "C:\\Services\\Server\\Server.INI" );
if( iniFile.ReadFile())
    my code...

The program never gets in the if block.

And, sorry for the confusing. I use this library for the CIniFile class. Hope this information helps to pinpoint the problem. http://www.codeproject.com/kb/cpp/cinifileByCabadam.aspx

EDIT2: I found the reason, it's because some of the ini files are saved as Unicode. And that's the reason ReadFile() fails. But now the question is how to read Unicode ini files.


Normally GetLastError() should give you an error number to look up

EDIT: In the CIniFile project there seems to be no default constructor, try instead CIniFile( string const iniPath ) i.e.

CIniFile iniFile( "C:\\Services\\Server\\Server.INI" );
if( iniFile.ReadFile())

EDIT2: OK, you would need to modify the code to instead of using fstream use wfstream - see

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜