Try adding input.clear(); This should fix the problem. This kind of explains it, although, I don't fully understand it myself. I thought when you closed the file everything reset. Perhaps someone else could explain.Code:... input>>word; cout<<word<<endl; input.clear(); input.close(); input.open("meaning.txt"); ...
Edit- It's probably better to put the input.clear() after you close the file.