>I tried FREAD instead of FGETS and it looks like it works fine, I tried to read 8192 bytes with FREAD then write them with FWRITE without any modifications and I got same file size.
With FREAD some occurences may be split between two sequential reads in which case they will not be replaced.
--sb--