Replace fgetc with fread. Orders of magnitudes faster.