Reading a word
I have this simple problem that I can't figure out. I'm trying scan in a text doc. and look for particular words. What would be the best way? I've tried using and put it in a loop but it only grabs a character at a time. I've also tried that stops at the white space and ends the program.
Same questions over and over again. Please do a search for reading from a file on these boards. There's also inumerous FAQs on the matter. Both on Cprog website as everywhere else in the web.
whole line - getline();
get - a character
<< a word, stops at a whitespace (space, tab, newline).
There's some stringstream thing, I think, which does the whole file. Search search search!
You'll probably need a loop of some kind too.