Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!daemon From: walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu Newsgroups: net.micro.amiga Subject: Seek() bug on RAM: Message-ID: <1636@caip.RUTGERS.EDU> Date: Wed, 26-Mar-86 05:42:17 EST Article-I.D.: caip.1636 Posted: Wed Mar 26 05:42:17 1986 Date-Received: Thu, 27-Mar-86 07:39:37 EST Sender: daemon@caip.RUTGERS.EDU Organization: Rutgers Univ., New Brunswick, N.J. Lines: 31 From: walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu Pardon me if this bug has been reported already, but I've never seen it. /* A file to demonstrate the Seek() bug. When run on any file in RAM:, the Seek call returns -1. It always works if the file is on disk. */ #include #include main(argc, argv) int argc; char **argv; { struct FileHandle *in, Open(); long Read(), Seek(); char buffer; if ( (in = Open(argv[1], MODE_OLDFILE)) != 0) { /* The next line is the offender; replacing or following it with Seek(in, 0L, OFFSET_END) gives the right answer */ while (Read(in, &buffer, 1L) >0); printf("File %s has length %ld\n", argv[1], Seek(in, 0L, OFFSET_CURRENT)); Close(in); } } Steve Walton ARPA: walton%deimos@hamlet.caltech.edu Caltech Solar Astronomy BITNET:swalton@caltech.bitnet Physics DECNET: DEIMOS::WALTON UUCP: your guess is as good as mine...