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" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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:[EMAIL PROTECTED]] > Sent: 29 November 2002 04:29 > To: Jeff; [EMAIL PROTECTED] > 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. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php