title: How can I increment a number in a file by an amount?
body: <p>I have got a .txt file which stores a players' money. I need this file to increment or detriment a certain amount depending on if the player kills something or if they buy something from the shop.</p>
  
  <p>The issue is that I do not know how to actually increment or detriment the contents. I can delete/recreate the .txt file with the new money, however because multiple threads will be accessing the file, then there is the risk that the file may not exist due to it being deleted and not regenerated yet.</p>
  
  <p>Just to clarify, there will only be one thread at a time modifying the file. Other threads will only be reading the file.</p>
  
  <p>So how would I do this without deleting the data/file first?</p>