本文整理汇总了C++中CConfigFile::ReadString方法的典型用法代码示例。如果您正苦于以下问题:C++ CConfigFile::ReadString方法的具体用法?C++ CConfigFile::ReadString怎么用?C++ CConfigFile::ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CConfigFile
的用法示例。
在下文中一共展示了CConfigFile::ReadString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Destroy
bool
CProject::Open(const char* filename)
{
Destroy();
// set the game directory
m_Directory = filename;
if (m_Directory.rfind('\\') != std::string::npos)
m_Directory[m_Directory.rfind('\\')] = 0;
// set the game filename
m_Filename = filename;
if (1) {
char directory[MAX_PATH];
GetCurrentDirectory(MAX_PATH, directory);
if (SetCurrentDirectory(m_Directory.c_str()) == 0)
return false;
FILE* file = fopen(m_Filename.c_str(), "a");
if (!file) return false;
fclose(file);
SetCurrentDirectory(directory);
}
// load the game.sgm
CConfigFile config;
if (!config.Load(m_Filename.c_str()))
return false;
m_GameTitle = config.ReadString("", "name", "Untitled");
m_Author = config.ReadString("", "author", "Unknown");
m_Description = config.ReadString("", "description", "");
m_GameScript = config.ReadString("", "script", "");
// screen dimensions
m_ScreenWidth = config.ReadInt("", "screen_width", 320);
m_ScreenHeight = config.ReadInt("", "screen_height", 240);
RefreshItems();
return true;
}