I have this binary file with showing the correct value when I opened the file using HexView.
4c 60 02 aa b4 c2 d1 e3 1a 01 00 00 8c 01 00 00 f5 01 00 00 52 02 00 00 bd 02 00 00 20 03 00 00 32 03 00 00 59 03 00 00
When I uses fread to read the 40 bytes data into a char buffer, it failed. From 9th byte data onwards, all the read back data is 0x00.
int main()
{
FILE *stream;
char flag[40]={0};
size_t numread = 0;
UINT theme = 0;
if ((stream = fopen("alignment.bin", "r")) != NULL)
{
numread = fread(&flag, 1, 40, stream);
fclose(stream);
}
else
{
cout << "File open failed" << endl;
}
system ("pause");
return 0;
}
1a
(a.k.a Ctrl+Z) which may be considered an end-of-file in Windows.