There are several ways to do what you want. And you don't have to be bound by limitations in the length of string variables. You can also write your string directly to memory and save all of that at once using memblocks. A similar thing can be achieved using arrays, but you may run into the string length problems that way.
Here is a loose version I put together that shows a way to use memblocks (blocks of memory) to store your strings and then write them all to a file at once. The example create a file about 2 megs in size filled with string data. I use individual strings to write to the memblock so there is an initial limit on how much can be written at once - but it's easy to loop through the functions to get it all done and contiguous. To write 20,000 strings to the memblock - each 100 bytes in length and then save the file takes about 2 to 3 seconds on my laptop. Once the file is created, it's really just one long string because I don't add any line feeds or carriage returns (intentionally). This is darkbasic classic I'm using so I think it should work in pro - I don't think the commands I used are too different. If it does work, it should be even faster in pro.
REMSTART
==============================================================
= TITLE :
= Author : latch
= Date : 05/27/2013
= UPDATE :
= Version:
==============================================================
Comments
==============================================================
REMEND
REM =============================================================
REM = SET UP DISPLAY
REM =============================================================
AUTOCAM OFF
SET DISPLAY MODE 800,600,32
SYNC ON
SYNC RATE 60
REM =============================================================
REM = MAIN
REM =============================================================
_main:
rem create a memblock string
a$="This is a test"
mem=1
writemode=1
length=2000000 : rem roughly 2 megs
p=memblock_string(mem,writemode,length,a$)
rem write a whole bunch of data to the memblock and save it as a file
for n=1 to 20000
a$=""
for c=1 to 100
a$=a$+chr$(rnd(255))
next c
memblock_string(mem,0,length,a$)
next n
save_memblock_string(mem,fname$)
sync
end
DO
SYNC
LOOP
END
REM =============================================================
REM = SUBROUTINES - PROCEDURES
REM =============================================================
REM =============================================================
REM = FUNCTIONS
REM =============================================================
function memblock_string(mem,writemode,length,string$)
remstart
Creates or adds strings to a memblock
mem == the memblock number to use
writemode == Various writemodes
0=add to existing memblock (mem). If the string will exceed the length
, the memblock size will be extended to include the new string
1=create new memblock mem of length in bytes
of length. If the memblock already exists, delete it and create new
If the memblock doesn't exist and the mode is 0, then
the memblock will be created with a default lenght of 255 characters
length == Only valid when writemode is 1 - the length in bytes to make a memblock
string$ == A string to add to the memblock. Max length of string$ is 255 characters
The first 4 bytes of the memblock will store the last position that was written to
remend
rem check writemode
if writemode=1
if memblock exist(mem) then delete memblock mem
if length<1 then length=255
make memblock mem,length+4
rem new memblock the first position to write to will be after the
rem 4 byte header
write memblock dword mem,0,4
else
rem the write mode is 0 - so add on string or create new if memblock
rem doesn't exist
if memblock exist(mem)
rem get the string length so we can see if we need to extend the memblock
ln=len(string$)
rem get the last position written to in the memblock
pos=memblock dword(mem,0)
rem add the length to the position and see if we are beyond it
if pos+ln > get memblock size(mem)
newlength=get memblock size(mem)+4+ln
rem we'll need a new memblock to copy data to
mem2=1
while memblock exist(mem2)
inc mem2
endwhile
make memblock mem2,get memblock size(mem)
copy memblock mem,mem2,0,0,get memblock size(mem)
rem delete the old memblock and create it longer
delete memblock mem
make memblock mem,newlength
copy memblock mem2,mem,0,0,get memblock size(mem2)
delete memblock mem2
endif
else
rem write mode is zero and the memblock does not exist
make memblock mem,255+4
rem new memblock the first position to write to will be after the
rem 4 byte header
write memblock dword mem,0,4
endif
endif
rem add on the new string
ln=len(string$)
pos=memblock dword(mem,0)
for n=0 to ln-1
newpos=pos+n
write memblock byte mem,newpos,asc(mid$(string$,n+1))
next n
rem update the header with the new position
write memblock dword mem,0,newpos+1
rem exist the function with the next position to write to
newpos=memblock dword(mem,0)
endfunction newpos
`================================================================
function memblock_string_to_screen(mem,xpos,ypos)
ln=get memblock size(mem)
pos=memblock dword(mem,0)
set cursor xpos,ypos
for n=4 to pos
print chr$(memblock byte(mem,n));
next n
endfunction
`================================================================
function save_memblock_string(mem,fname$)
fn=1
while file open(fn)
inc fn
endwhile
if fname$="" then fname$="memblock_string.txt"
if file exist(fname$)
break "File exists - "+fname$
end
endif
open to write fn,fname$
write memblock fn,mem
endfunction
REM =============================================================
REM = DATA STATEMENTS
REM =============================================================
The idea is, the tools are available to manipulate stuff the way you want. There is a lot to learn about DB. I've gotten used to it and (using classic) I feel like I can do just about anything I need to with it. It's one of the better BASIC's in my opinion. I will admit, it's default file and string handling isn't the greatest.
Enjoy your day.