Hi Xabi,
Try using FPUTS() instead of FWRITE() and FGETS() to read it. Your binary file may contain special line characters (LF and CR or LFCR). FGETS() is sensitive to these characters where FWRITE() is not. HTH
Tom
Tom Bishop
Sr. Database Designer/Developer
TYBRIN Corp.