That example's short n' cute, I like that.
*Thanks for the suggestions, pointers, et cetera. Trust me, I'm not looking to create code any more complex than it need be, just doing my best to understand it all.
That example's short n' cute, I like that.
*Thanks for the suggestions, pointers, et cetera. Trust me, I'm not looking to create code any more complex than it need be, just doing my best to understand it all.
Since we're on this subject of getline (grabbin' words), etc., if you have a file buffered as a string file (not char, but a 'string myfile'), is there a method of applying getline to read the string or perhaps another method that I'm unfamilar with?
ie.won't work since myfile isn't istream but the stored contents of the file. I need to process the data a 2nd time before output to a file, though I can't figure out how to do that.Code:getline(myfile,anotherstring,'\n')
Last edited by Oldman47; 01-01-2007 at 08:37 AM.
Use a stringstream
KurtCode:string myfile; // holds the total contents of a textfile stringstream str(myfile); while ( getline( str, anotherstring /*, '\n' */ ) ) { // '\n' is default // process anotherstring }
Ah! So that's how one does that. Thanks. I was scratchin' my head for several hours over this.