Re: File handling

From: Date: Fri, 29 Nov 2002 08:56:25 +0000
Subject: Re: File handling
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126456@lists.php.net to get a copy of this message
I've got this coed but it still don't do the business: $MESSAGE_FILE="foobar.txt"; $handle=fopen("$MESSAGE_FILE","w"); $sizez= sizeof($handle); $string= 'foo'; while ( fgets($handle,$sisez) { fputs($handle,$sizez); if (strstr($handle,$string)){ break; } } Any ideas? "Jeff Ringrose" <JRingRose@atlasalu.ie> wrote in message news:97E3260093E08D43A791F2DF1584C29705C807@ATLAS2K.atlasalu.ie... > Justin, > Option b. delete all AFTER "foo", I.E. truncate the file directly after > "foo". Leaving "foo" and all the data before "foo" untouched. > > Jeff > > -----Original Message----- > From: Justin French [mailto:justin@indent.com.au] > Sent: 29 November 2002 04:29 > To: Jeff; php-general@lists.php.net > Subject: Re: [PHP] File handling > > > > Quick one, how do i read a file for a key word, say "TEXt", and the delete > > the rest of the remaining file? > > > Do you mean: > > a) how do i make sure a word (eg "foo") is in a file, and if it is, delete > all contents of the file except the word "foo" OR > > b) how do i search a file for the word "foo", and delete everything in the > file AFTER the word "foo" > > ?? > > > Justin French > -------------------- > http://Indent.com.au > Web Development & > Graphic Design > -------------------- > > > DISCLAIMER: The information in this message is confidential and may be > legally privileged. It is intended solely for the addressee. Access to this > message by anyone else is unauthorised. If you are not the intended > recipient, any disclosure, copying, or distribution of the message, or any > action or omission taken by you in reliance on it, is prohibited and may be > unlawful. Please immediately contact the sender if you have received this > message in error. Thank you. > >

« previous php.general (#126456) next »