ANSI draft - seeking to eof

Henry Spencer henry at utzoo.UUCP
Sun Dec 1 11:04:28 AEST 1985


> Does this really mean that there's no guaranteed way to seek to the end of
> either a text or a binary stream in ANSI C (when such a beast exists)?

Only the kludgey one:  read the whole file, and do an ftell() when you hit
the end; then you can seek back there.  Maybe.  Remember that many operating
systems find it very difficult to do a seek in the Unix sense:  their files
simply do not support such an operation in any straightforward way.  Most
programs that want to do non-trivial file manipulation just cannot be
written in such a way as to port to such machines gracefully.  There is no
good way around it.  The minimal X3J11 semantics for seek reflect this.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list