[futurebasic] Re: [FB] STR# question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: JoeAtTIME@...
Date: Fri, 14 May 1999 10:36:09 EDT
In a message dated 5/14/99 7:38:15 AM, you wrote:

<<I know....your suggestions to kiss my STR# stuff is right but it is taking
several minutes to load the 800k file over the network to put into STRING$()
stuff.  I would like to try the STR# stuff one time only at the initial
load.  I can do an initial loop to convert but it takes about 30 seconds on
my G3.  I tried to modify the suggestion (which works great) that Jay gave
for converting the read file# to the string$() stuff but trying to go from
the STR# to string$() is another one of my flaws.

Obviously, I am not a good programmer.  This is giving me a bad offset.

itemnumber=FN countStr(_diagnosislistSTR)
LONG IF itemnumber>0
    StrHndl& = FN GETRESOURCE(_"STR#",_diagnosislistSTR)
    OSErr  = FN HNOPURGE(StrHndl&):gOffSet&=0
    FOR Myloop=1 TO itemnumber
      POKE @DIAGNOSIS$(Myloop),48           'Set length byte
      BLOCKMOVE [StrHndl&]+gOffSet&,@DIAGNOSIS$(Myloop)+1,48'move string
      gOffSet& = gOffSet& + 48              'get offset of next string
    OSErr  = FN HPURGE(StrHndl&)


Thanks, Terrald

 I think this line:     gOffSet& = gOffSet& + 48              'get offset of 
next string

 should be:     gOffSet& = gOffSet& + 50              'get offset of next 

Strings contain a length byte and also need to be padded to an even number of 
bytes. So you have the string = 48 bytes + 1 length byte + 1 unused byte = 50 
bytes total.
-Joe Lertola