How to get counter on txt?
I want to write custom gameid to .txt file, example: a1, a2, a3, a4 and etc then admin runs custom command. And every time that ID increase like example first time i wrote custom command in server and write into .txt file: a1. Next time if i use same command wirte to txt file a2 but removes before a1 text. :) I hope u understand what i neeed. I try do something like that:
PHP Code:
|
Re: How to get counter on txt?
Simplest way is to write in a new line every time.
Then loop fgets to retrieve the data, and count it or w/e you need to do with it. EDIT: Oh i misunderstood what you are trying to do ( you wan't to delete the previous input and not leave it ) Thats even easier, you should still retrieve it with with fgets or w/e then close the file and use PHP Code:
Use what you retrieved previously to print whatever you need into the file Also its good practise not to use read_file and write_file, thats why I didn't, but it would be fine to use those in your case, if you want to. |
All times are GMT -4. The time now is 18:40. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.