i write an array to csv file using fputcsv in php . i know that fputcsv writes a empty line as the last out put so my csv looks like
- apples
- orranges
- pear
- empty last line
What i did to remove the last empty line was use the below code and it works it writes a csv without the last empty line.
$stat = fstat($handle);
ftruncate($handle, $stat['size']-1);
My problem is that it delets the LF code and what than means on the next time i append to my csv a new value just gets appended to the same line as line 3 in stead of next line because the LF is missing ...
- apples LF
- orranges LF
- pear
anyone know how to fix the above ?