Just open the file in mode "w".

$fp = fopen("your_file", "w");

There is also the the function fseek(), which 
will allow you to move the file pointer around
to any place in the file. Mode "w" will
suffice for your needs. 

fopen() - http://www.php.net/manual/en/function.fopen.php
fseek() - http://www.php.net/manual/en/function.fseek.php

Thanks

Jeremy Allen

-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 17, 2001 3:57 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Delete File Contents?


I've created a program that runs a process then stores the results to a
file on the server. I would like the file to contain only the most
recent update, but it seems I can only append to my using fopen. Is
there a way to open the file and overwrite the data in that file? I've
considered deleting the file and creating a new one but that seems like
a lot to do. It would be nice if there were a way to set a pointer to
the top of the file and overwrite.

Thanks,
Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to