Programming in Turbo Pascal 7, I'm using the following code:
Through echo checking, I find that the loop works fine for 20 or less iterations. However, at the 21st iteration, I recieve an error at the line "
". The error says "File not open for input", even though it was been reset before the loop, and there is no close command until after the loop. Is there perhaps a limit to the amount of reading that you're allowed to do from a file in one go?
Code:
(*********************************************************)
procedure InputData ( var DataFile : text; var Collection : MagicCardCollection; var EntryCount : integer);
Begin
EntryCount:=0;
reset (DataFile);
while (not (EOF(DataFile))) do
begin
Inc(EntryCount);
with (Collection[EntryCount]) do
begin
readln (DataFile,Name);
readln (DataFile,Artist);
readln (DataFile,Effect);
readln (DataFile,Rarity);
readln (DataFile,SetName);
readln (DataFile,Legality);
readln (DataFile,CardType);
readln (DataFile,FlavorText);
readln (DataFile,Color);
readln (DataFile,Power);
readln (DataFile,Toughness);
readln (DataFile,ManaCost);
readln (DataFile,Quantity);
readln (DataFile,Price);
end;
end;
close (DataFile);
End;
(********************************************************)
Through echo checking, I find that the loop works fine for 20 or less iterations. However, at the 21st iteration, I recieve an error at the line "
Code:
readln(DataFile,Color)