I have this function:
/*This func runs *.c1 file, and replace every include file with its content It will save those changes to *.c2 file*/ void includes_ext
If you look at your code you have to places where you write to the target file.
If I were you I would set a break point at
}/*frst if*/ else { fputc(ch,c2_fp); // brk point here }
to check what you are actually writing there.