Determining EOF using fseek()?
From: Orion (wong01_at_bigpond.net.au)
Date: 08/27/04
- Next message: Dan Pop: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Previous message: William L. Bahn: "Re: Why is that?"
- Next in thread: Villy Kruse: "Re: Determining EOF using fseek()?"
- Reply: Villy Kruse: "Re: Determining EOF using fseek()?"
- Reply: Eric Sosman: "Re: Determining EOF using fseek()?"
- Reply: Karthiik Kumar: "Re: Determining EOF using fseek()?"
- Reply: Anand: "Re: Determining EOF using fseek()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 27 Aug 2004 14:08:23 GMT
Hey,
I was wondering if it was possible to determine if you hit 'EOF' using
fseek? I'm using fseek to traverse through the file from start to end
and capturing the data into a linked list structure. However, my loop
doesn't seem to work well - it totally fumbles out actually:
while ((a = fseek(fp,0,SEEK_CUR)) == 0){
// code here
}
Its quite important for me not to disrupt the current position of the
cursor since I rely on that to fetch the data from the text file. I
thought that the loop would work fine since fseek only returns a
non-zero integer on an error but unfortunately this is not the case.
Anyone with suggestions with using fseek() or some other function?
Any help would be greatly appreciated! Thanks.
- Next message: Dan Pop: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Previous message: William L. Bahn: "Re: Why is that?"
- Next in thread: Villy Kruse: "Re: Determining EOF using fseek()?"
- Reply: Villy Kruse: "Re: Determining EOF using fseek()?"
- Reply: Eric Sosman: "Re: Determining EOF using fseek()?"
- Reply: Karthiik Kumar: "Re: Determining EOF using fseek()?"
- Reply: Anand: "Re: Determining EOF using fseek()?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|