#include <stdio.h>
#include <stdlib.h>
//#define MAXBUF 1024*1024
int main()
{
FILE *fp;
char str[sizeof(MAXBUF)];
int i;
fp = fopen("frame1PETData.dat","r");
if(fp == NULL){
perror("Error opening the file");
return -1;
}
if(fgets (str,sizeof(MAXBUF),fp)!= NULL)
{
puts(str);
for(i =0;i<60;i++)
{
printf("%hhx",str[i]);
}
}
fclose(fp);
return(0);
}
In the following program, when i try to print the hexadecimal data from the file, the output is in the following way.
But the actual data is as shown below which is different from output data.
a6 d2 fe 44 3c 00 00 ff ff ff ff ff ff ff ff 1a
78 1a 61 1a 80 1a 70 01 0c 1a cf 14 01 11 18 00
b8 05 c0 1c 03 70 15 01 12 89 00 58 06 00 24 01
21 23 01 a5 cb 00 60 06 80 64 01 b2 22 01 a7 8b
00 70 04 c0 22 00 b3 11 01 ad 87 00 d8 10 00 4a
02 24 10 01 ae fa 00 50 04 00 18 01 45 08 02 29
8a 00 90 04 00 2c 02 b6 30 02 29 a5 01 30 08 00
Is my program wrong? And before every byte it is appending ff byte.