Name: Anonymous 2011-05-25 8:55
I got a function that adds to the vector which is
scores = new vector<string>;
void addToVec(string name, int score)
{
scores->push_back(name);
scores->push_back((char*)score);
addToFile(scores);
}
then i want to add it to a output file with
void addToFile(vector<string> scores)
{
ofstream outFile(SCORES_FILE, ios::app);
if(outFile.fail()) {
cout << "Could not write to scores file, exiting program" << endl;
exit(1);
}
for (int i = 0; i < scores.size(); i++) {
outFile << scores[i];
outFile << " ";
}
outFile.close();
}
But i keep getting a "no matching function for the call 'addToFile(std::basic_string...etc etc"
My code all wrong?
scores = new vector<string>;
void addToVec(string name, int score)
{
scores->push_back(name);
scores->push_back((char*)score);
addToFile(scores);
}
then i want to add it to a output file with
void addToFile(vector<string> scores)
{
ofstream outFile(SCORES_FILE, ios::app);
if(outFile.fail()) {
cout << "Could not write to scores file, exiting program" << endl;
exit(1);
}
for (int i = 0; i < scores.size(); i++) {
outFile << scores[i];
outFile << " ";
}
outFile.close();
}
But i keep getting a "no matching function for the call 'addToFile(std::basic_string...etc etc"
My code all wrong?