[futurebasic] STR# change

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

From: "Terrald J. Smith, M.D." <tjsmith@...>
Date: Wed, 05 May 1999 12:43:14 -0500
Ok...I am trying to use the global variables instead of the STR# stuff to
stop the error -39

This FN works the first time the program is started, however, when it is
quit and another start is tried, I get a type 3 error.  What it is
apparently doing is corrupting a CDEF I have with id=0.  Interestingly, if I
replace the CDEF in the compiled program, it does not seem to be an issue
anymore.

Any thoughts as to why the corruption is happening?

I REM out the FN GetFileData$ and the STR#(_filedataSTR,2) stuff and it did
not change the corruption so I think this FN is the issue.

LOCAL FN GETDIAG(FILENUMBER,DIAGNOSIS)
  LONG IF CHECKDX=0
    DIM DATAFILE$,MODIFIED$,itemnumber$,OSErr
    DIM itemnumber,Filesize&,StrHndl&
    DIM loop,gOffSet&,Myloop
    MODIFIED$=STR#(_filedataSTR,2)
    DATAFILE$="DXFILE"
    itemnumber$=FN GetFileData$(DATAFILE$, MYFOLDER%)
    IF DIAGNOSIS=0 THEN MODIFIED$=""
    LONG IF itemnumber$<>MODIFIED$
      itemnumber=LOF(FILENUMBER,48):Filesize&=LOF(FILENUMBER,1):gOffSet&=0
      StrHndl&=FN NEWHANDLE(Filesize&+5)
      OSErr=FN HNOPURGE(StrHndl&)
      READ FILE#FILENUMBER,[StrHndl&],Filesize&
      FOR Myloop=1 TO itemnumber
        AZ$=""
        FOR loop=1 TO 48
          AZ$=AZ$+CHR$(PEEK([StrHndl&]+gOffSet&))
          INC(gOffSet&)
        NEXT
        DIAGNOSIS$(Myloop)=AZ$
      NEXT
      OSErr  = FN HPURGE(StrHndl&)
    END IF
    CHECKDX=1
  END IF
  LONG IF DIAGNOSIS>0
    AZ$=DIAGNOSIS$(DIAGNOSIS)
  END IF
END FN

Thanks, Terrald