Last modified on 7 July 2009, at 20:12

Futurebasic/Language/conversion

Both FB and FBtoC are capable of utilizing several different ways to locate files and folders including: FSSpecs, FSRefs, CFURLRefs and POSIX paths.

At times a programmer has a need to convert between the formats. The Carbon Toolbox—understood by both FB and FBtoC—offers several functions to expedite such conversions. They include:

FSpMakeFSRef: Convert an FSSpec to an FSRef (Deprecated since OS X 10.5)
FSGetCatalogInfo: Convert an FSRef to an FSSpec (For legacy code)
FSPathMakeRef: Convert a POSIX file path to an FSRef
FSRefMakePath: Convert an FSRef to an POSIX file path
CFURLGetFSRef: Convert a CFURLRef to an FSRef
CFURLCreateFromFSRef  : Convert an FSRef to a CFURLRef
CFURLCopyFileSystemPath : Convert a CFURLRef to POSIX Path
CFURLCreateWithFileSystemPath : Convert a POSIX path to CFURLRef

(Source code examples and more discussion to follow)

4d69 646e 6967 6874

0100 0011 0110 1111 0110 0100 0110 0101 0111 0010 0010 0000 0010 0000 0010 0000