From: cs3prj04 AT lion DOT cs DOT latrobe DOT edu DOT au (Cs3prj Group 04) Newsgroups: comp.lang.c,comp.lang.c++,comp.os.msdos.djgpp Subject: Can not reset an open ifstream file. Date: 19 Sep 1996 06:10:12 GMT Organization: Comp.Sci & Comp.Eng, La Trobe Uni, Australia Lines: 40 Distribution: world Message-ID: <51qo44$e2@lion.cs.latrobe.edu.au> NNTP-Posting-Host: lion.cs.latrobe.edu.au To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp After running the below program I would be perfectly justified in saying that the fools who designed the iostream/fstream classes have provided no means of reseting an open file so that it can be read again. With the do while loop commented out seekg works as you would expect it to and you see, on the screen, the first line of the file printed out twice. However with the do while loop uncommented the call to seekg fails under all circumstances and you see the first line of the file printed only once. Can any body show me that I am wrong. #include #include #include "string.hpp" void main() { //fstream In("main.cpp",ios::in|ios::out); ifstream In("main.cpp"); StringC Line; In>>Line; cout<>Line; } while (!In.eof()); In.seekg(0); In>>Line; cout<