note 72497 added to function.fopen

From: Date: Sun, 21 Jan 2007 12:05:04 +0000
Subject: note 72497 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-121981@lists.php.net to get a copy of this message
Note: If you have opened the file in append mode ("a" or "a+"), any data you write to the file will always be appended, regardless of the file position. But PHP distinguish between read and write position, and you may freely read at any position, but when you write it will always append at the end. If you don't want that write restriction, open the file in read-write mode ("r+") and then start by moving the file pointer to the end. if (($fp = fopen($filename, "r+") === FALSE) { // handle error exit; } if (fseek($fp, 0, SEEK_END) === -1) { // handle error exit; } ---- Server IP: 129.16.214.50 Probable Submitter: 83.226.130.103 ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- https://master.php.net/note/edit/72497 Del: integrated -- https://master.php.net/note/delete/72497/integrated Del: useless -- https://master.php.net/note/delete/72497/useless Del: bad code -- https://master.php.net/note/delete/72497/bad+code Del: spam -- https://master.php.net/note/delete/72497/spam Del: non-english -- https://master.php.net/note/delete/72497/non-english Del: in docs -- https://master.php.net/note/delete/72497/in+docs Del: other reasons-- https://master.php.net/note/delete/72497 Reject -- https://master.php.net/note/reject/72497 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#121981) next »