Hi, I need some help getting this to work right. I get errors with the last few lines of my code. It works like this or should work like this:
1st if say doesnt = anything then(else) save this to a file
2nd open file
3rd look in file for whats in side, then that will be saved to a string
4th learn=line+say+nothing+learn+whitespace
5th save "learn" to file
6th close file
last restart loop of my programe
Thats about it on how it should work, this what error I get is: no matching function for call to `getline(std::string&, std::string&)' hope you can help out, thanks if you can or point out if I made a mistake some where.
Code:string say; string line; string learn; string learnfile = "learn.txt"; string nothing = ": "; string whitespace = " ||"; //more code in middle here else{cout<<"Hmm, I must not have this in my data yet, can you plez tell me what this word means?"<<endl; getline(cin, learn); ifstream learnfile; ofstream myfile; myfile.open (learnfile.c_str()); while (getline(learnfile, line)) learn=line+say+nothing+learn+whitespace; myfile << learn; learnfile.close (); cout<<"Saved, thanks for your help on making me better."<<endl;}}}//end of code



LinkBack URL
About LinkBacks



wow, took me forever to get thisO.o; um you can delete this if you like^^;