Hello. So the most I can tell you is i'm having serious trouble with my code of writing to a txt file. It's not that my code isn't working, it's that c++ is outputting WEIRD crap that makes no logic sense, doing things out of order, and just seriously screwing things up.
Would someone please take a look at the following code and see if it looks right to you?
ofstream userfile;
userfile.open ("data/users/users.dat");
userfile << number_of_users;
for (int i = 0; i < number_of_users; i++)
{
userfile << "\n" << users[i] << "\n" << UserDifficulty[i];
}
userfile.close();
and how about this code...does this next part look right to you?
ifstream file ("data/users/users.dat");
if (file.is_open())
{
while (! file.eof() )
{
getline (file,number_of_users1);
istringstream buffer(number_of_users1);
buffer >> number_of_users;
for(int i = 0; i < number_of_users; ++i)
{
getline(file,users[i]);
getline(file,UserDifficulty[i]);
}
}
file.close();
}
Please please please help! I cant figure it out. Thanks :) I'm so frustrated