Note I'm not entirely sure on the semantics that calling code expects so I made some guesses. In particular, using seek() on a file opened with the append flag only moves the read pointer, not the write pointer. Also the inline definition of the whence enum in seek() is a bit gross. Normally I would probably move that out into the header and change the signature of seek to use the enum rather than a string, however I designed the code be as minimally invasive as possible.
Note I'm not entirely sure on the semantics that calling code expects so I made some guesses. In particular, using
seek()
on a file opened with the append flag only moves the read pointer, not the write pointer. Also the inline definition of the whence enum inseek()
is a bit gross. Normally I would probably move that out into the header and change the signature of seek to use the enum rather than a string, however I designed the code be as minimally invasive as possible.