Hi there:
I am trying to output a single variable to a binary file, but couldn't get it done correctly.
result = 17.0;
if ((OutFp1 = fopen("myfile.bin", "wb")) == NULL)
{
Application->MessageBox("File can't open.", NULL, IDOK);
return;
}
fwrite(&result,sizeof(result), 1, OutFp1);
fclose(OutFp1);
if ((InFp15 = fopen("myfile.bin", "rb")) == NULL)
{
Application->MessageBox("File can't open.", NULL, IDOK);
return;
}
fread(&rest,sizeof(rest), 1, InFp15);
fclose(InFp15);
After 'rest' readed in from the binary file, it equals zero!
Can any one point out where I made mistake?
THank you!