Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: magic cookies given back by ftell, and used in fseek Message-ID: <572@goofy.megatest.UUCP> Date: 26 May 88 06:58:40 GMT References: <129@lakart.UUCP> Organization: Megatest Corporation, San Jose, Ca Lines: 22 in article <129@lakart.UUCP>, dg@lakart.UUCP (David Goodenough) says: > > There has been much discussion in this group on the fact that on certain > systems (VMS I believe), ftell & fseek use magic cookies to tell about > file position. I have my asbestos suit ready if this suggestion is out of > line, but have the ANSI comittee considered providing some means to convert > from cookie format to and from character position in file. The problem is that some operating systems have file-format built into them :-(, whereas UNIX has unformated byte-streams :-). One example is to store "lines" in variable length records, prefixed by a line-length number. So now if the devil chooses a byte-count offset x, and says fseek(x), you've got to do some pretty fancy stepping to find the correct record and offset into it. For such a file, ftell would presumably return a magic cookie which codes for record number and offset. Sigh. -- Dave J.