Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 7 results for
welcomenote
- Page 1
delete a line(string) from a file c++
Programming
Software Development
11 Years Ago
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
11 Years Ago
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
11 Years Ago
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
11 Years Ago
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
11 Years Ago
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
10 Years Ago
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
10 Years Ago
by Ancient Dragon
Instead of line 3 and 4, why not just this: if(line!=deleteMovie) { outfile<<line<<endl; }
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC