From: CSBVAX::MRGATE!info-vax-RELAY@KL.SRI.COM@SMTP 18-JUL-1988 03:43 To: ARISIA::EVERHART Subj: Problems with C I/O Received: from CUNYVM.CUNY.EDU ([128.228.1.2]) by KL.SRI.COM with TCP; Wed, 13 Jul 88 07:24:23 PDT Received: from UMKCVAX1.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 5964; Wed, 13 Jul 88 01:07:29 EDT Date: Tue, 12 Jul 88 16:33 CDT From: Subject: Problems with C I/O To: info-vax@kl.sri.com X-Original-To: info-vax@kl.sri.com, KIERSTEIN Info-VAXers, I've found a problem as I was converting ARC to run on the VAX. I converted the code, and generated some archives, but then when I tried to extract the entries, some of the entries failed the checksum test. Upon investigation, I found that the archive entry for that file was all binary zeros! Several other entries in this particular archive as well as other entries in other archives were the same way. In checking out the problem, I noticed that on the first archive, that the bad entry started at A6E02 (printed by ftell()). With the same executable, I shortened the filenames (I changed the files in the headers to strings), and when the entry started on A6DFF or less, the entry was perfect! If greater or equal to A6E00, then binary zeros! The following header and entry were in fine shape. The code involved is a tight loop copying a file from a scratch file to the archive (in arcpack.c). Something like while ((c = fgetc(crn)) != EOF) fputc (c, f); In this loop, I inserted the following: i = ftell(f); /* Where are we? */ fputc (c, f); /* Output byte */ fseek (f, i, 0); /* Go to where we were */ if (c != fgetc(f)) printf ("Error in copying to archive at %d\n", i); The error message never was written! I also put come code in there to print out every nth character, and it did, but close the file and leave, binary zeros. I converted all the I/O to fopen, fclose, fgetc, fputc, ftell and fseek, but no dice. I fflushed the file after every character in the loop, no dice. I fclosed and reopened the file before the loop, no dice. I played with fseeking to the beginning of the file, then back to EOF, but no dice. Any ideas for a frustrated person? If you have a version of ARC for the VAX, make sure that your entries check out (arc t archive). Barry Kierstein Computing Services University of Missouri - Kansas City Kierstei@Umkcvax1.Bitnet