File Spec Records
Revised: February 2002 (FB^3 Release 6)
File spec records (FSSpecs) are the modern replacement for FB's time tested volume reference number/file name combinatons. You can create a file spec record as follows:
DIM fs AS FSSpec
A file spec record is defined in the headers as follows:
BEGIN RECORD FSSpec
DIM vRefNum AS SHORT
DIM parID AS LONG
DIM name AS STR63
When the FSspec is used as a parameter in
OPEN the information is passed to file handling calls as a single record, but you may extract information from the record as follows:
DIM fs AS FSSPEC
fileName$ = fs.name
parentID& = fs.parID
volRefNum = fs.vRefNum
OS x vs OS 9 volRefNum
OS X does not allow the use of the older vRefNum/fileName combination. In order to insure that your programs work correctly without modification, the FB runtime creates a list of parent IDs and volume reference numbers and substitutes the list element number
for the old volume reference number. Look at the difference between the calls below:
fileName$ = FILES$(_fOpen,_"PICT", "Open a picture", refNumVar%)
fileName$ = FILES$(_fOpen,_"PICT", "Open a picture", fbElemNum%)
Your program won't require changes to move from the old to the new style calls, but will become OS X savvy without any additional coding.
Extracting Real Information From FB Indexed List Information
A utility function has been provided that extracts the true volume reference number and parent ID from FB's indexed table.
Pass the pseudo volume reference number to the routine in the
vRefNum% parameter. On return, the true volume reference number is placed in the
vRefNum% variable and the correct parent ID is place in the
FSMAKEFSSPEC -> FBMakeFSSpec
A utility function provided by the runtime lets you build a file spec from individual components. This function has been designed to work with all versions of the system software. It's parameters are identical to those of the toolbox version of the call, but this particular function is smart enough to know when it id dealing with real parameters and when it has encountered the indexed element number from FB's substitute parameters.
DIM fs AS FSSpec
FN FBMakeFSSpec(inVol%,inDir&,name$, fs )
name$ parameter is a null string, FB returns information about the parent folder.
/* Not Supported by FBtoC */
You will not be able to use many of the file utility functions (like
FN GetRealVolAndDir) unless you include the proper header file as follows:
FBMakeFSSpec is unsupported in FBtoC.