Folks----I'm probably overlooking something easy here since I've been
busy Carbonizing for several hours now.
First, the easy question:
1. Why does the compiler tell me to use DIM @ for the "ignore"
variable in FN lockfile? As you can see it is already defined to
force non-register storage.
2. The code below mostly works to create an FSSpec record (I proved
that by OPENing the file and printing the contents using the FSSpec
record). The problem is with FN lockfile and this is most likely
where I'm going brain dead. If I just call the TB filelock directly
with xx = FN FSpSetFLock(@PrefSpec), it locks the file and works
fine. If I try to call the FN lockFile I get a "volume not found"
(-35) error. I've tried passing both the address of (@) and not for
the PrefSpec rec when calling lockfile with the same results.
Any input would be appreciated!
TIA.......Brian
DIM @ PrefSpec as FSSpec
DIM @ filename as str255
DIM @ ignore as INT
DIM @ somedata as str255
LOCAL MODE
LOCAL FN FindPrefsVol(name as str255,PrefSpec AS ^FSSpec)
DIM @ vRef AS INT
DIM @ dirID AS LONG
LONG IF FN
FINDFOLDER(_kOnsystemdisk,_kPreferencesFolderType,0,vRef,dirID) =
_noErr
FN FBMakeFSSpec(vRef,dirID,name,PrefSpec)
END IF
END FN
LOCAL MODE
LOCAL FN lockFile(theFSSpecRec as ^FSSpec,bool%)
DIM @ ignore as INT
LONG IF bool%
ignore = FN FSpSetFLock(theFSSpecRec)
XELSE
ignore = FN FSpRstFLock(theFSSpecRec)
END IF
END FN = ignore
'MAIN
filename = "another test for BSS"
FN FindPrefsVol(filename,PrefSpec)
OPEN "I",#1,@PrefSpec
INPUT #1, somedata
PRINT somedata
CLOSE #1
'ignore = FN FSpSetFLock(@PrefSpec)<---------this works
'do
'until fn button
ignore = FN lockFile(PrefSpec,_true) ' this doesn't work