[net.micro.amiga] Seek

walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu (03/26/86)

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 <stdio.h>
#include <libraries/dos.h>

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...

bruceb@amiga.UUCP (Bruce Barrett) (03/27/86)

>From: walton%DEImos.Caltech.Edu@Hamlet.Caltech.Edu
>
>Pardon me if this bug has been reported already, but I've never seen it.
>
	PLEASE DO report bugs!  I would say that generally they are useful
to the entire net, but if you are feeling tinid at least send main to
amiga.support (or me).  Thanks.
>
>/* 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. */

This is a known bug (in 1.1 and 1.0??) It will be fixed for the next release.
--Thanks,
  Bruce Barrett
(Have you cleaned your mouse this week?)