dimanche 29 juillet 2018

I'm stuck how to advance to the next line in fstream txt file;

int gamer::loadGame()
{
fstream loadFile("Save.txt", ios::in | ios::out | ios::app);
if (loadFile)
{
    loadFile.seekg(0, loadFile.end);
    int fLen = loadFile.tellg();
    loadFile.seekg(0, loadFile.beg);
    if (fLen == 0)
    {
        return 0;
    }
    else
    {
        int l, e, g,n,c;
        string s, p;
        loadFile  >> p >> l >> e >> g>>s>>c>>n;
        for (int i = n; i !=0; i--)
        {
            loadFile >> p >> l >> e >> g;
            myLevel = l;
            myExp = e;
            myGold = g;
            myPick = p;
            saveOrder[c - 1] = s;
        }
        return 1;
    }
}
system("CLS");
gOptions();
}

I'm trying to look through one part of a save which is level gold and exp but how can i go to the next part since there can be more than one save. So how can i go from the first part of the save to the next?

Aucun commentaire:

Enregistrer un commentaire