Re: ftruncate

From: Date: Thu, 15 Mar 2007 21:03:05 +0000
Subject: Re: ftruncate
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-250692@lists.php.net to get a copy of this message
On 3/15/07, Richard Lynch <ceo@l-i-e.com> wrote:
On Thu, March 15, 2007 4:57 am, Swati Asthana wrote: Is there any function in php through which we can delete / truncate the content of a text file that is before the file pointer/file handler ? can we use truncate? actually im using a function to pick the content from a text file using 2 delimiters, but that function checks only the first instance of the delimiter.. If you want to chop the END of a file off, the ever-so-cleverly-named ftruncate will do that. http://php.net/ftruncate If you want to chop the FRONT of a file off, I don't think you can do that... In fact, given the way some operating systems maintain their file catalogs, I'm almost positive you can't do that. What about reading the rest of the file and store it in a new file?
Then delete old file, and rename new file to old file and you have what you need i think. Tijnema
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#250692) next »