I want to report:
on Apache/2.0.48 (Linux/SuSE), PHP Version 4.3.3.
It is very different in "a" and in "r" modes.
After fopen in "a" mode, I don't have to fseek before ftruncate ($fp, 0) and even between ftruncate and the following fputs (if I need to write to the begining of the file).
But if I open in "r" mode and read some bytes, and then I want to ftruncate ($fp, 0) and write again - I do need to put fseek($fp, 0); just after ftruncate ($fp, 0).
Latet