Make sure you close the previous file before opening a new one, as DBP only allows 32 files to be open at once. You might be increasing the level number before the file open check, which will always tell you it's closed, since it's moved on to the next file already.
This is a bit of code that will load all your levels at one time and store them in an array:
dim myfile(0,0) as string `first number is the file number (level), second is the line number in the file
fnum as integer `file counter
fline as integer `line counter
flinemax as integer `holds array size
fnum=0 `set for first file
while file exist(str$(fnum)+".txt") `check for file
open to read fnum+1,str$(fnum)+".txt" `open file
while not file end(fnum+1) `check for end of file
read string fnum+1,myfile(fnum,fline) `read line into array
fline=fline+1 `get ready for next line
if fline>flinemax `see if array needs resizing
dim myfile(fnum,fline) `resize array
flinemax=fline `set new array size
endif
endwhile
close file fnum+1
fline=0 `reset line counter for next file
fnum=fnum+1 `increase file counter
dim myfile (fnum,flinemax) `increase array size for next file
endwhile
rem here's how to read the data back out
for x=0 to fnum:for y=0 to flinemax
if myfile(x,y)<>"" then print "f:"+str$(x)+" l:"+str$(y)+" "+myfile(x,y)
rem ^ since the array must be as large as the longest file, check for a blank line
rem ^ if you need blank lines in your files, use a line that signifies the end of
rem ^ the file, such as "***ENDFILE***" and change the "" above
next y:next x
wait key
rem You might wonder why I used fnum+1, it's b/c file numbers must be greater than 0
rem You might also wonder why I started with file 0.txt, I did it b/c arrays start at 0
rem I could have started with 1.txt, but I'd either have to -1 on the array read/writes, or waste 0,0
The example assumes that all your level files all are numbered starting with 0.txt
_____________________
Windows Vista: Just say no.