Hi
I've made a function that will write a string to a text file and it works ok except that if i write a new string to the same file there are bits of the end of the string added like this :
DBCODENAME;;;;67, cours gambetta;11, tour d'aygosi ;13100;aix en provence;;06xxxxxxxx;person@mail.com;;;27/05/1963;u;4560
560
7/05/1963;u;4560
when it should be
DBCODENAME;;;;67, cours gambetta;11, tour d'aygosi ;13100;aix en provence;;06xxxxxxxx;person@mail.com;;;27/05/1963;u;4560
here's my function
function writeFile($str,$name,$path = FTP_PATH_OUT){
$made = touch($path.$name);
op($path.$name,"path");
chmod($path.$name,0705);
$handle = fopen($path.$name, "r+");
fwrite($handle, $str);
fclose($handle);
}
what do i need to add so that the file is wiped before writing the new data ? I've had a look in the manual but haven't seen anything that mentions this problem
thanks