If you use fread you have to open the file in binary mode