Code: (Select All)
dim ditem(1 to 7) as long
dim as long ff, count, total
count = 1
ff = freefile
open "example.dat" for input as ff
do until eof(ff)
total = total + 1
input #ff, ditem(count)
count = count + 1
if count > 7 then
count = 1
gosub dosomethingwithdataitems
end if
if total >= 4000 then exit do
loop
close ff
if total < 4000 then
print "Unexpected end of data items"
if count > 1 then print "Incomplete data set"
end if
end
dosomethingwithdataitems:
'put code here to do something with ditem()
return
This is how I would have done things, as I've studied from the first post of this topic. As I've said, no need for recursion. No need to seek back to the beginning of the file.