I'm not sure, but when you open the file again, instead of "ios::in", try "ios_base::beg", which tells it to move to the beginning of the stream. For more details though, just type in "fstream" at cplusplus.com, a wonderful wonderful reference site, though a lot of it is actually in c, not c++...