Menu

#707 SEEK doesn't work with files opened for APPEND

open
nobody
None
rtlib
2016-04-08
2013-10-06
Matthew
No

Issue raised at http://www.freebasic.net/forum/viewtopic.php?f=2&t=21650 .

It seems that fseek() - and I guess fseeko() - don't work with "ab".
There might be a possible workaround at http://stackoverflow.com/a/15095272/446106 , using "r+b" and seeking to the end? But if fseek is unreliable in text mode, then maybe that's not enough..

Discussion

  • MrSwiss

    MrSwiss - 2016-04-08

    In my opinion NOT a Bug, see FreeBASIC / Forum thread below.
    The Bug was: to ever allow such thing (in QB).
    see: http://www.freebasic.net/forum/viewtopic.php?f=2&p=218564#p218562

     
  • fxm (freebasic.net)

    Yes, on reflection I agree:

    In QuickBASIC, 'SEEK' in 'APPEND' access mode allows to adjust the pointer position anywhere in the file, with a quantum equal to the byte.
    But from the pointer position, the provided characters replace the previous ones, so not in insertion mode but in overwriting mode.
    This behavior does not correspond to the acces mode name ('APPEND') because within file, there is not an addition but only a substitution.

    In FreeBASIC, 'SEEK' is ignored in APPEND access mode, and one might wonder rather if FreeBASIC is right and QuickBASIC bugged?

     

Log in to post a comment.