change fprintf by fwrite
change fprintf by fwrite