Use fgetc to read a character instead of fscanf, since it will correctly work on big and little endian