this function should read a file word by word and it does work till the last word, where the run stops
void readFile( ) { ifstream file; file.open
what you are doing here is reading one character at a time from the input stream and assume that all the characters between " " represent a word. BUT it's unlikely to be a " " after the last word, so that's probably why it does not work:
"word1 word2 word2EOF"