[futurebasic] Re: [FB] File Open & Save again

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2004 : Group Archive : Group : All Groups

From: George Beckman <gbeckman@...>
Date: Sun, 3 Oct 2004 19:05:46 -0700
See below...
----
Best Wishes,

George
http://www.pggp.com
On Oct 3, 2004, at 12:59 PM, Brian Heibert wrote:

> What is wrong with this?  I am getting a STOP dialog
>
> STOP at line 3346
> In file: SUBS COMPILER.INCL
> The program has returned a file error. Error: "File Not Found"  File 
> Ref: 1
>
> I think there are things wrong with both FN SaveDoc & FN OpenDoc
>
> Brian
>
> LOCAL FN SaveDoc
> savprompt$ = "Save .tbd~ file?"'FN loadSTR$(135)
> filnm$ = "Untitled.tbd~"
> // File Type: tbd~
> fileName$ = FILES$(_fSave,savprompt$,filnm$,vRefNum%)
> LONG IF LEN(filename$)
> gFBUseNavServices = _zTrue
> if filename$ = "" then filename$ = filnm$

the line above can't happen because you are inside a loop that only 
happens if fileName is longer than ""

> DEF OPEN "tbd~"
> OPEN "O",1,filename$,,vRefNum%
> GET FIELD efHandle&, efID%
> WRITE FIELD #8001, efHandle&
> CLOSE #1
> KILL FIELD efHandle&
> END IF
> END FN
>
> LOCAL FN OpenDoc
> dim gFileSpec as fsSpec
> filename$=Files$(_fsspecOpen,"tbd~",,vRefNum%)

as long as you dimmed it,  would suggest:
filename$=Files$(_fsspecOpen,"tbd~",,gFileSpec
and later...
OPEN "I", 1, @gFileSpec

> gFBUseNavServices = _zTrue
> DEF OPEN "tbd~"
> LONG IF LEN(filename$)
> OPEN "I", 1,gSaveName$,,vRefNum%

You are using gSaveName$ here but FIles filled filename$

OPEN "I", 1,filename$,,vRefNum%
should work.


> READ FIELD #8001, efHandle&
> EDIT FIELD #8001, &efHandle&
> CLOSE #1
> KILL FIELD efHandle&
>
> //open "I", #1,@gMyFileSpec
> //READ #1,runcode$
>
> //CLOSE #1
> XELSE
> BEEP
> END IF
> END FN
>
> FN SaveDoc
> FN OpenDoc
>
> --
>