I am writing a program that needs to read in from a file word by word (ie- read from one whitespace to the next whitespace and store those characters in a string). I know the getline function reads line by line but can not find a word by word equivalent.
1 2 3 4 5 6 7
string readFile (char* filename){
ifstream file;
string word;
file.open(filename);
word = //reads in word from file
return word;
}