[futurebasic] Containers, handles & str# resources

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2001 : Group Archive : Group : All Groups

From: Bernie Wylde <bernie@...>
Date: Tue, 27 Nov 2001 10:15:34 +0000
Hi Guys,
I'd like to copy the contents of an external str# resource to a local str#
resource. This isn't a problem until the text is > 255 chrs.

Should I use a container for this or get the handles and do a blockmove or
is there another way?

I'm using pg/fb3^5 and my function, is something like this:

'=== start of function ===
local fn readScriptsResources
dim scriptName$, scriptText$
dim extResfileRef
dim as int item, count

extResfileRef = fn openrfperm(gScriptsFileName$, gScriptsVol, _fsRdPerm)
long if extResFileRef <> -1
count = fn countStr(_extScriptsID)
call closeresfile(extResFileRef)

long if count
for item = 1 to count
extResfileRef = fn openrfperm(gScriptsFileName$,gScriptsVol,_fsRdPerm)

scriptName$ = str#(_extScriptsID,item)
scriptText$ = str#(_extTextsID,item)        '(1)

call closeresfile(extResFileRef)
fn apndElement(_ScriptsListSTR, scriptName$
fn apndElement(_textsSTR, scriptText$       '(2)
next item
end if

FN viewListItem(_ScriptsList,1)

end if
end fn
'=== end ===

I've tried substituting the container scriptText$$ at (1) and (2) above but
I just get garbage in my local str# (_textsSTR). I'm obviously using the
container incorrectly.

Also, as you can see, I'm repeatedly opening and closing the ext resource as
I cycle through the elements. Is this bad practice?

Any help appreciated.

Cheers
Bernie