Author Topic: EOF is not reset when using seek  (Read 544 times)

Offline FellippeHeitor

  • QB64 Developer
  • Forum Resident
  • Posts: 1889
  • LET IT = BE
    • QB64.org
Re: EOF is not reset when using seek
« Reply #15 on: March 15, 2020, 06:50:51 AM »
Thanks for reporting and for the detailed example.

Offline davidf

  • Newbie
  • Posts: 6
Re: EOF is not reset when using seek
« Reply #16 on: March 16, 2020, 05:39:41 AM »
Until a fix is sorted

These are the work arounds I am using

As opposed to seeking to a position within the file and reading data that wont
take the program to the eof or reopening the file. I have a temporary fix , I doubt
that it is efficient, but here it is anyway.

My Work arounds

2 methods
FIRST ONE
get the file length (STORE IT IN A LONG_INTEGER)
lof_file&=lof(1)
compare seek position with lof

change :- WHILE NOT EOF(1)
to        :- WHILE SEEK(1)<lof_file&

SECOND ONE
or minimum code change (using alternative function)
CHANGE :- WHILE NOT EOF(1)
to        :- WHILE NOT ALT_EOF(1)


FUNCTION ALT_EOF(fileno%)
    IF SEEK(fileno%) >= LOF(fileno%) THEN
        ALT_EOF = -1
    ELSE
        ALT_EOF = 0
    END IF
END FUNCTION

ps does anyone else have a problem inserting code , when using Microsoft Edge

Offline bplus

  • Forum Resident
  • Posts: 3767
Re: EOF is not reset when using seek
« Reply #17 on: March 16, 2020, 11:05:12 AM »
Quote
ps does anyone else have a problem inserting code , when using Microsoft Edge

See here: https://www.qb64.org/forum/index.php?topic=2283.0

The button clicks in editor don't work but you can do type the tags manually:
[ code=qb64 ]   [ / c ode ]
without the spaces.