• Advertisement
Sign in to follow this  
  • entries
    122
  • comments
    121
  • views
    68722

Item loader

Sign in to follow this  

94 views

Well, so far so good. I've managed to make it "see" the 's' in the first line of the file, and then act to take in the number just after it. The code I have so far is below; still has mainly debugging cout statements, but at least I'm gettimg somewhere.


void LoadGame() // Still implementing
{
ifstream gameIn(file.c_str());
string line, prev;
do
{
gameIn >> line;
prev = line;
for (int i = 0; i < line.length(); i++)
{
cout << line;
if (line == 's')
{
i++;
cout << ": S will have ";
for (int it = i; line[it] != '!'; it++)
{
cout << line[it];
i++;
}
cout << " object." << endl;
}
break;
}
break;
cout << line << endl;
} while (!gameIn.eof() && line != prev);
gameIn.close();
}

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement