Using 5.0.10 on Windows, I'm unable to correctly use al_fread.
I have a struct, 102 bytes in size, which I save directly to a file to store the game configuration. Under all operating systems the write works correctly. Using a hex editor I can verify the data is stored correctly, and is the right size.
When loading it, all 102 bytes are fine except on Windows, where invariably after 20 bytes al_feof returns true. I've tried loading this in every way I can think of, including abuse of al_fgetc, manually looping with al_fread16le, and loading with al_fread pointing to the struct address I want to fill. Always it loads twenty bytes, and does not set an error flag.
Screenshots of the problem are attached to this post. In the terminal I am rendering the read struct contents, and when it fails my sanity check it writes a new copy with the correct data visible below it. The hex editor is the data shown correctly on disk, and the relevant code is included as well.
Does anyone know what's going on here?
There it is, I did forget to specify binary reading/writing. Thanks for the tip. It works great now.