delete a line(string) from a file c++ Programming Software Development by opel123 …main() { vector<string> sV; int decision; welcomeNote: { cout<<"Welcome to MovieTime!"<<…;)"<<endl; } outfile.close(); delete[] movie; goto welcomeNote; }break; case 2: { system("cls"); string txt… Re: delete a line(string) from a file c++ Programming Software Development by nullptr Use `std::getline(cin, deleteMovie);` At present, if you entered 'when i met your mother(2009)', only 'when' would be read into deleteMovie. The behaviour you see after that is because the input stream isn't empty. Refer to http://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream Also, remove the calls to `main()` … Re: delete a line(string) from a file c++ Programming Software Development by opel123 Thank you for replying, nullptr.i have been busy with the holidays. Still,it doesn't work.i am to try the gets() as soon as i get in touch with a computer (just dropped by using a smart phone). Thank you very much! Re: delete a line(string) from a file c++ Programming Software Development by Ancient Dragon >i am to try the gets() Don't bother with that. use getline() as nullptr suggested. Re: delete a line(string) from a file c++ Programming Software Development by opel123 okay hi!im back.the getline(cin,deleteMovie); actually did work.but i had to do it twice.found this site concerning this piece of code http://stackoverflow.com/questions/12723509/why-must-type-getlinecin-string-twice thank you guys for replying :) this problem is solved.thank you!:) Re: delete a line(string) from a file c++ Programming Software Development by cloudx.cx ok this is the problem, i just tested its work fine :) while(getline(file,line)) { if(line==deleteMovie){} else {outfile<<line<<endl;} } outfile.close(); file.close(); Re: delete a line(string) from a file c++ Programming Software Development by Ancient Dragon Instead of line 3 and 4, why not just this: if(line!=deleteMovie) { outfile<<line<<endl; }