www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/03/08/14:28:44

From: Don Bowman <bowman AT waterloo DOT hp DOT com>
Subject: ifstream seekg problem
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Mon, 8 Mar 93 13:32:04 EST
Mailer: Elm [revision: 70.85]

I am having problems with the ifstream seekg member: it seems to always
return EOF.

In particular, I am doing something along these lines:

int main(int argc, char **argv)
{
    ifstream("in");

    while ( !in.eof() ) {
	read data and parse it
    }

    in.seekg(0);	// tried seekg(0, ios::beg) also

    while ( !in.eof() ) {
	re-read data
    }

}

Looking in the iostream library code I found that there is a member
seekg which always returns EOF... Am I doing something wrong?

-----
Don Bowman			bowman AT waterloo DOT hp DOT com		519-883-3085

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019