Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!pacbell!att!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c Subject: Re: A self-referential challenge Message-ID: <8039@chinet.chi.il.us> Date: 27 Mar 89 03:42:16 GMT References: <6219@bsu-cs.UUCP> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 27 In article <6219@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >consider the following problem. The command > brik -G * > crc.lst >generates a list of filenames and CRCs in crc.lst, which may be later checked >with > brik -C crc.lst >This always reports a CRC error for "crc.lst" itself, since the CRC >recorded for it was based on its contents before it was closed. What I >would like to do is find a way of having brik generate a CRC list that >includes the corect CRC of the file containing that list. There are actually two problems here: finding the file where the output is directed and making the CRC value correct. Under unix fstat() and stat() should let you check to see which file is your output. If you remember what value you wrote for that file and CRC all of your output you could just keep writing junk at the end of the file until the CRC turned out to be correct. Reminds me of a story I once heard about sales vs. service people: ...the salesmen tell the lies - the customer service people have to make them come true. Les Mikesell