[futurebasic] Re: Converting FB projects to FBtoC

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Wed, 17 Sep 2008 21:06:27 +1200
Several list members are in a quandary about file handling. One member  
wrote privately, but I hope won't mind my quoting:

> I have not made the jump to FBtoC because of file handling and the  
> general confusion within Macdom about volrefs, FSpecs, FSrefs and  
> er... the other type!

File handing in FB and FBtoC.

FB only
1. name alone
     open "I", 1, "SomeFile"   [a file in app's folder]
2. name and one number
     open "I", 1, "SomeFile",, wdRefNum  [wdRefNum is an (obsolete)  
working directory]
3. name and two numbers
     open "I", 1, "SomeFile",, vRefNum, dirID

FB and FBtoC
4. FSSpec
     open "I", 1, @fileSpec
An FSSpec record contains name, vRefNum and parID (same as dirID in #3  

FBtoC only
5. FSRef
     open "I", 1, @fileRef
Limitation: open "A" not yet implemented in FBtoC.
     open "I", 1, @fileURLRef
Limitation: open "A" not yet implemented in FBtoC.

 From the brief survey above, it is apparent that the easiest way of  
converting old file code for FBtoC is to migrate to FSSpecs throughout.

You can make the conversion while working on your project with good  
old FB4 and FB Compiler.app. When you come to use FB5/FBtoC, your  
FSSpec code should "just work".

#1-4 share the well-known naming limitations of pre-OS X code (31  
MacRoman characters). Once your project runs with FBtoC, you may want  
to migrate further to FSRefs, to allow 255 Unicode chars. CFURLRefs  
are typically used only for rare special reasons.

Robert P.