RE: [PHP] overwriting file record

From: Date: Fri, 18 Oct 2002 05:17:23 +0000
Subject: RE: [PHP] overwriting file record
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120460@lists.php.net to get a copy of this message
Sure, try; $fp=fopen($filename,"r+"); fseek($fp, $recordstartoffset, SEEK_SET); fwrite($fp,$string,strlen($string)); fclose($fp); This should work, (haven't tried it lately) You will want to make sure your string is the right length, and calculate the recordstartoffset carefully. You may also want to consider opening the file with the binary safe mode (add a "b" to the mode), especially if your server is running under windows. I would also recommend you add some error checking on the write. hope this gets you where you want to go. Warren Vail -----Original Message----- From: DoL [mailto:dwylau@netvigator.com] Sent: Thursday, October 17, 2002 9:40 PM To: php-general@lists.php.net Subject: [PHP] overwriting file record Hi All Is there a smarter way to update a file record instead of moving all records to a new temp file and rename it back afterwards? Many Thanks /dl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#120460) next »