S
Shalaka Joshi
Hi,
I have binary file say, "test.bin". I write "FF" in the file and expect
my code to read 255 for me.
char * lbuf;
int lreadBytes ;
long lData;
FILE *pFile = fopen ("c:\\testbin","rb");
// Read data from binary file
lreadBytes = fread(lbuf,1 ,1,pFile);
if(lreadBytes!= 0)
{
lData = atol(lbuf); // converting char* to long
}
This does not work. lData is not 255 as i expect
How do I convert char* to long when reading the binary data?
Thanks and Regards,
Shalaka
I have binary file say, "test.bin". I write "FF" in the file and expect
my code to read 255 for me.
char * lbuf;
int lreadBytes ;
long lData;
FILE *pFile = fopen ("c:\\testbin","rb");
// Read data from binary file
lreadBytes = fread(lbuf,1 ,1,pFile);
if(lreadBytes!= 0)
{
lData = atol(lbuf); // converting char* to long
}
This does not work. lData is not 255 as i expect
How do I convert char* to long when reading the binary data?
Thanks and Regards,
Shalaka