Re: Using PHP to remove certain number of bytes from file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2007-12-30 at 17:20 +0000, Scott Wilcox wrote:
> Is it possible with PHP to remove a certain number of bytes from a file, 
> purely within PHP?

Yes. Why wouldn't it?

> If so, does someone have an example of doing this, removing the first 
> 230 bytes from a file.

No, that's an awfully specific problem. But here's the tools you'll
need:

fopen(), fread(), fwrite(), fclose().

Further info... you could do this without creating a separate temporary
file (meaning shift bytes within a single file), but I suggest using a
temporary target file for writing the new content, and then replacing
the original once everything has completed successfully.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux