从具有名称和值对的文件中读取值时,我设法跳过了名称部分。但是有没有另一种方法可以跳过名称部分而不声明一个虚拟字符串来存储跳过的数据?
示例文本文件:http: //i.stack.imgur.com/94l1w.png
void loadConfigFile()
{
ifstream file(folder + "config.txt");
while (!file.eof())
{
file >> skip;
file >> screenMode;
if (screenMode == "on")
notFullScreen = 0;
else if (screenMode == "off")
notFullScreen = 1;
file >> skip;
file >> playerXPosMS;
file >> skip;
file >> playerYPosMS;
file >> skip;
file >> playerGForce;
}
file.close();
}