[PHP] write to specific place in file

2002-03-15 Thread John P. Donaldson

How do I write to a specific place in a file instead
of just using fputs to append text to the end of the
file?

Thanks,
John

__
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

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




Re: [PHP] write to specific place in file

2002-03-15 Thread Bas Jobsen

First read it, then split and then write it.

$fp=fopen($file,r);
$content=fread($fp,filesize($file));
fclose($file);
$parts=explode($splitsign,$content);
$fp=fopen($file,w);
fwrite($fp,$parts[0].$insert.$splitsign.$parts[1]);
fclose($file);


Op vrijdag 15 maart 2002 19:09, schreef John P. Donaldson:
 How do I write to a specific place in a file instead
 of just using fputs to append text to the end of the
 file?

 Thanks,
 John

 __
 Do You Yahoo!?
 Yahoo! Sports - live college hoops coverage
 http://sports.yahoo.com/

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