[futurebasic] Re: Re: [FB] STR#

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

From: BMichael@...
Date: Wed, 5 May 1999 21:17:49 EDT
>My problem with this (MY problem) is that I cannot figure out how to use the
>array issue with over 15000 strings with one resource and about 900 with the

!!!!!!! That's a lot of strings. _Way_ too many to store in STR# 
resources and read into an array one at a time. Is there any particular 
reason you _have_ to use STR# resources? Could all that be in a data file?

I'd use the "write array to disk" and "read array from disk" functions, 
if I had that much data. Using a hacked version of your current program 
plus "writefilerecord", create your data file (after loading the array 
from STR# once). Then take out all the STR# stuff and replace it with 
"readfilerecord". If it's static data, you won't need writefilerecord in 
the finished program.

Here's the relevant parts;

DIM gFirst%(1)                   'denotes start of 'to save to disk' area
DIM gString1$(15000)
DIM gString2$(900)
DIM gLast%(1)                    'denotes end of 'to save to disk' area

LOCAL FN writefilerecord
  DIM arraySize&
  OPEN "O", 1, gFileName$,,gSaveVolum%
  PRINT #1, gVersion$
  arraySize& = @gLast%(0) - @gFirst%(0)
  WRITE FILE #1, @gString1$(0),arraySize&
  CLOSE #1

LOCAL FN readfilerecord
  DIM arraySize&
  OPEN "I", 1, gFileName$,,gSaveVolum%
  INPUT #1, gVersion$
  arraySize& = @gLast%(0) - @gFirst%(0)
  READ FILE #1, @gRawData(0),arraySize&
  CLOSE #1

This is liberally hacked from a much bigger routine, so it may have typos 
or bugs...