Why does my Loop end after 11 Loops?
#31
(02-07-2023, 09:50 PM)SMcNeill Wrote:
(02-07-2023, 09:36 PM)bplus Wrote: The point in my eye is to use recursion to go through and process the file without a main loop.

I am sure "The file" would work in your simplest demo that does not use recursion.

Seek in my opinion is big fat Red Herring, distraction.

Code: (Select All)
DIM SHARED AS LONG DataCount, DataItem(7)
OPEN "someFile.txt" FOR INPUT AS #1
DataCount = 1
Recur

SUB Recur
    IF DataCount = 1 THEN SEEK #1, 1 'move to the start of the file 'may need to change to 0 for 0 index counting
    FOR i = 1 TO 7
        INPUT DataItem(i)
    NEXT
    DataCount = DataCount + 7
    CALL WorkSub
    IF DataCount < 4000 THEN Recur
END SUB

SUB WorkSub
    'work on these specific data items
END SUB

No main loop?  Check.
Recursion?  Check.
SEEK?  Check.

What's missing here??

Didn't need share and don't need  If DataCount < 4000 and would be good to close file. You probably don't need those things either.

But fine!

update: No it's not, try code with real file, it needs some fixes. Missing close for any file not 7 * 4000 big.
b = b + ...
Reply


Messages In This Thread
Why does my Loop end after 11 Loops? - by Dimster - 02-06-2023, 07:08 PM
RE: Why does my Loop end after 11 Loops? - by bplus - 02-07-2023, 10:55 PM



Users browsing this thread: 24 Guest(s)