1. You're using a post-increment ($read_hits++), that increments the variable after it's written to the file.
2. Between the read and write in write_hits, you need to seek back to the beginning of the file to overwrite the previous value, rather than appending it to what was read.
In reply to Re: Reading and incrementing an integer
by Dr. Mu
in thread Reading and incrementing an integer
by echosilex
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |