[futurebasic] Re: [FB] Loading File speed

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

From: GBeckman@...
Date: Fri, 30 Apr 1999 23:30:50 EDT

	Are you getting the error before or after the read.  It may be that 
your handle is going bad on you.

	Here is the whole thing...almost... and I will put some comments in 
now and then in areas that I had to do some figurin'

DIM Student,Assignment,Subject,Counter1,Counter2
DIM Filesize& ,myMen&,StrHndl&
DIM dummy,OsErr%,HoldTheVolNum,fileKey,makeAlias
DIM holdtheName$,myLocal$,myLocal1$,Dummy$
LOCAL FN OpenFromWindows
  gOpenType$="TEXT"                               'files to open
  FN pGopenFile
  LONG IF LEN(gFileName$)  

<<check to be sure you really have a name>>
    CURSOR _watchCursor
    OPEN "I",#3,gFileName$,,gFileVol

<<Here because I needed a file size for later and because I needed to check 
handle, I decided to use it as my flag
    StrHndl&=FN NEWHANDLE(fileSize&+5)
<<try for a handle and then check to see it has something in it.  If not, you 
may not have memory enough for it.  >>

    LONG IF (StrHndl&<>_nil)
      osErr%=FN HLOCK(StrHndl&)

<<I am never sure what routines can move memory, so I locked it during the 
      READ FILE#3,[StrHndl&],fileSize&
      osErr%=FN HUNLOCK(StrHndl&)
    END IF
    CLOSE #3
    LONG IF FileSize&<>0
      fileKey=FN MainReadNumber%(3,StrHndl&)
      LONG IF FileKey=400                         'got the right file
        gGradeEquivalency%=FN MainReadNumber%(2,StrHndl&)

In a message dated 4/30/99 4:23:34 AM, tjsmith@... writes:

> I tried
>Beckman's suggestion but kept getting type 1 errors (my fault I am sure)