When I try to read an integer from a binary file and the integer is either 13 or 26 the programm doesn't read it correctly, otherwise there is no problem. I've checked and edited the file with a hex editor and it is alright. I've tried standard C and similar problems occur. I'm desperate. HELP!
This is a simple version of a function that shows what I mean.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
FILE *in, *out;
int c, rein, raus, dummy;
in=fopen("c:\\test.bin","w"
;
rein=13; //26;
c=fwrite(&rein, sizeof(int), 1, in);
fclose (in);
out=fopen("c:\\test.bin","r"
;
c=fread(&raus, sizeof(int), 1, out);
Label1->Caption=rein;
dummy=raus;
Memo1->Lines->Append(dummy);
fclose (out);
}
This is a simple version of a function that shows what I mean.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
FILE *in, *out;
int c, rein, raus, dummy;
in=fopen("c:\\test.bin","w"
rein=13; //26;
c=fwrite(&rein, sizeof(int), 1, in);
fclose (in);
out=fopen("c:\\test.bin","r"
c=fread(&raus, sizeof(int), 1, out);
Label1->Caption=rein;
dummy=raus;
Memo1->Lines->Append(dummy);
fclose (out);
}