Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!mtunx!rutgers!mailrus!ames!lll-tis!oodis01!uplherc!sp7040!obie!wsccs!terry From: terry@wsccs.UUCP (Every system needs one) Newsgroups: comp.lang.c Subject: Re: magic cookies given back by ftell, and used in fseek Message-ID: <565@wsccs.UUCP> Date: 4 Jun 88 03:02:37 GMT Article-I.D.: wsccs.565 References: <129@lakart.UUCP> Lines: 35 Summary: no, not exactly In article <129@lakart.UUCP>, dg@lakart.UUCP (David Goodenough) writes: > 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. No, not really. They work fine on stream files. The problem is that they return record number on "Implied carriage control" (VMS default) text files. > [...] but have the ANSI comittee considered providing some means to convert > from cookie format to and from character position in file. Come to that > is such a thing possible? No. Only the record format, and ANSI doesn't usually say anything about Digital's file system... they really shouldn't, anyway, as it is none of their business. > [...], or is it some other reason. Yes. It's the "real" storage format and RMS file access modes implied in the C library. use: ungetc( getc( fp)); This will correctly align records after a read so that ftell() doesn't lie throught it's figurative teeth. | Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry | | @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry | | SLC, Utah | | These opinions are not my companies, but if you find them | | useful, send a $20.00 donation to Brisbane Australia... | | 'Admit it! You're just harrasing me because of the quote in my signature!' |