Good day. On Windows XP (FAT32), I wish to write something on a text file and to avoid other people from writing on it at the same time, I used flock.
$tmp_file = fopen("temp_log.txt", "ab");
flock($tmp_file, 2);
fwrite($tmp_file,"line of text");
How I try out is: Immediately after locking the temp_log.txt, I let one of the script sleep for few seconds. Then I run another script which also want to write into temp_log.txt.
Surprisingly, it can be written although it's locked.
I heard "flock" cannot be used on Windows. Is it true? Which version of Windows are they?
Also, do we have to unlock the file by using flock("filename", 3)? Or, if we call fclose, the lock will be automatically released?
Thanks and hope to hear from you all soon.