[comp.sys.apple2] Word or Byte? That is the question.

crew@pro-harvest.cts.com (Chris Wicklein) (08/17/90)

   When the _SFGetFile routine (using what ever version is available under
System Disk 5.0.2) returns pathnames and complete pathnames of the choosen
file, is the pascal string started with a length WORD, or a length BYTE?
   All my books aroung here suggest it's a byte, but they all date back to
System 3.0 and ProDOS 16 :). A word would be better for use under GS/OS.
 ________________________                          _________________________
|                         ProLine: crew@pro-harvest                         |
|                    Internet: crew@pro-harvest.cts.com                     |
|                       UUCP: crash!pro-harvest!crew                        |
|                  ARPA: crash!pro-harvest!crew@nosc.mil                    |
|_______________ BITNET: crew%pro-harvest.cts.com@nosc.mil _________________|

jonah@amos.ucsd.edu (Jonah Stich) (08/17/90)

In article <3964@crash.cts.com> crew@pro-harvest.cts.com (Chris Wicklein) writes:
>   When the _SFGetFile routine (using what ever version is available under
>System Disk 5.0.2) returns pathnames and complete pathnames of the choosen
>file, is the pascal string started with a length WORD, or a length BYTE?
>   All my books aroung here suggest it's a byte, but they all date back to
>System 3.0 and ProDOS 16 :). A word would be better for use under GS/OS.

Well, if you're using _SFGetFil, it's a Pascal (ie. length BYTE) string. This
is nice because it guarantees the length of the returned record. The new
_SFGetFile2 calls, which you really should use if you're doing anything for
the GS, return GS/OS (lenght WORD) strings. This gets a little hard, as a 
GS/OS string can be up to 64K, I believe, and you can' go specifying that 
you hav eto pass a 64K buffer, now can you? So, _SFgetFile2 instead allocates
twohandles, if you set the passed parameters right, that are exactly the right
size. I've found this to be REALLY nice, as you don't have to worry about 
your buffer being to small AND Dyou retain full compatibility with GS/OS. Of
course, if you want to use _SFGetFile2, you need tb Ref vol 3, but then again
you need that for just about ANY serious development these days, so that 
shoudn't be a problem. Hope this has helped!

Jonah

ps. To Apple: A pat on the back to the guy who thought of allocating handles,
both in the SF calls and  the TE calls. Thanks! You've made out life TONS 
easier!