KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am making a simple page load counter by storing the current count in a file. This is how I want to do this: Lock the file (flock) Read the current count (fread) Increment it (++) Write new count (fwrite) Unlock file/close it (flock/fclose) Can this be done without losing the lock? As I understand it, the file can't be written to without losing the lock. The only way I have come up with to tackle this, is to write a character using "r+" mode, and then counting characters.
Tags (comma-separated)
Save Edits
Cancel