Skip to content
  • 0 Votes
    13 Posts
    9k Views
    JonBJ

    @vishbynature
    I don't claim to understand what the best way to do whatever you want here is. Maybe @Pablo-J-Rogina's suggestion of a database. The one thing I can tell you is that achieving whatever you are attempting by seeking to byte #80 in a text file and overwriting what is there is not the right approach.

    If you want some solution which involves sticking with text files, it should look something like: open the existing file for read, open a new file for write, read stuff from old and write to new, making whatever modifications you wish as you go along, close both, delete old file, rename new to old. A few more steps than you wanted! Or, if file not too large, read whole file into some memory structure, make your changes there, write whole memory structure back to the file, completely replacing it.