|
Post by Mark on Mar 1, 2005 23:26:14 GMT
When I try to run my program I get the "input past end of file message". What did I do wrong?
|
|
|
Post by Ildûrest on Mar 2, 2005 5:08:14 GMT
You've INPUTed more times than there are lines in the file. Simple as that.
To counter it, it's highly advisable to use
DO UNTIL EOF(filenumber) ... LOOP
Where <filenumber> is the number you used in your OPEN statement. EOF(n) returns a TRUE value (-1, actually) when the end of file n has been reached.
If you're already using such a loop, then maybe you're, for example, inputting 2 lines at a time while the file has 5 lines. (So the first 4 lines go OK but then you try to input two lines when there's only one left, without checking in between)
Good luck.
|
|
|
Post by qekocateluj on Apr 17, 2019 5:37:39 GMT
|
|
|
Post by ANY on Nov 7, 2020 13:08:06 GMT
I also have same problem. How to fix it? My code is like this CLS OPEN "marks.txt" FOR INPUT AS #1 (marks.txt is the file name) DO UNTIL EOF(1) INPUT #1, NAME$, MARKS#, REMARKS$ PRINT "NAME";NAME$ PRINT"MARKS";MARKS# PRINT"REMARKS";REMARKS$ DO WHILE INKEY$="" (here do while inkey$="" is to loop only when we press any key) LOOP LOOP
Problem is I can print all the value except for last one For example IF the data is "Harry",86,"Fail" "Mary",98,"Pass" "George",100,"Pass" PLease HELP. You can contact me on "dzard10@gmail.com"
|
|