note 37169 added to function.fwrite
| From: | david at amoureux dot com | Date: | Wed, 05 Nov 2003 16:43:29 +0000 |
| Subject: | note 37169 added to function.fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59951@lists.php.net to get a copy of this message | ||
English:
If you want to rewrite a very used text file (for a chat...), you've got some time a empty file
(one of your users read the file while a other is writing).
I resolved this problem with -rename-
rename use a temp file and replace the target without delay.
So... write to a other file and replace the main file with rename.
French:
Si vous voulez mettre à jour un fichier texte très utilisé (pour un chat...), il arrive que
celui-ci soit écrasé (une utilisateur lit le fichier pendant que l'autre écrit dessus).
J'ai résolu le problème en utilisant la commande -rename-
rename utilise un fichier temporaire et remplace la cible sans délais.
Donc... Ecrivez sur un autre fichier et remplace le fichier principal avec rename.
----
Manual Page -- http://www.php.net/manual/en/function.fwrite.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37169
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37169&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37169&report=yes
Search -- http://master.php.net/manage/user-notes.php