[futurebasic] Error -39

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1999 : Group Archive : Group : All Groups

From: "George Beckman" <gbeckman@...>
Date: Wed, 03 Nov 1999 23:04:51 -0800
Gang,

    I am having a problem, that finally has me fairly frustrated.  I have a
program that uses a data file of a static size.  The file is 181790 bytes
long.  I use my beta daily in my work and have never had a save problem. 
However, testers occasionaly...and I mean very rarely, have a short file,
that is to say the file is less than 181790 causing the -39 error.  (-39 is
an eofile error that indicates the end came sooner than expected.)

    To combat this, I have been saving the file, closing the file, flushing
the volumn, reopening the file, checking the length and putting up a dialog
if the save was not 181790.  No one gets the dialog, but the error pops up
in a read.

    THe actual file save and read is a series of Write File # and Read FIle
# statements.  This only happens on Appletalk and Floppies.  LocalTalk is
the worst.  In fact, that is what led me to believe that the disk write was
not actually being completed and the file was half done and that a flush
would force an actual disk write.  The short files are not of any consistant
length.  This is a PG project.

    Here is how I flush:

    CLEAR LOCAL
    DIM pBlock.128

<big snip>

    pBlock.ioVRefNum% = gSaveVol
    osErr%=FN FLUSHVOL(@pBlock)
    LONG IF osErr%<>0 
      CALL PARAMTEXT("I am having a problem saving your file.","","","")
      FN pGshowErr(0)
    END IF

    The follow check works, because during development, I changed the file
size and forgot to change this puppy and it came up, but, somehow it can
write a short file and not see it.

    OPEN "I",#1,gSaveName$,,gSaveVol
    lgth&=LOF(1,1)
    CLOSE #1

    LONG IF lgth&<>181790
      FN pGcntrRes(_"ALRT",602)
      CURSOR=1000
      x=FN ALERT (602,0)
      gDirty=_True
    END IF



<snip>

    I am nearing the end of my Beta and have not had this happen for weeks
(with close to 40 testers) and today it is back and more than once.  I would
really like this to go away.

    Thanks in advance,

    George