hatten das Thema schonmal, aber ich bekomme es nicht hin.
Ich habe ein Hex File (siehe Anhang)
aus diesem Möchte Ich ab Adresse 80 4 Byte lesen. sprich: DD 47 2C 44
Diese sollen jeweils in eine variable (oder ein Array) gespeichert werden.
Ich habe das hier mal angefangen.
Code: Alles auswählen
#include <stdio.h>
int main()
{
int n=0;
int start=128;
char chr1[5];
FILE *file1;
file1=fopen("1a.bin","rb");
fseek(file1, 0, SEEK_END);
printf("Die Datei ist %ld Bytes gross!!\n\n", ftell(file1));
while (n<4)
{
fseek(file1, start, SEEK_SET);
chr1[n]=getc(file1);
fprintf(file1,"%x",chr1[n]);
n++;
printf("Zeichen %d ist %x\n",n,chr1[n]);
}
return 0;
}
ich habe die Bin datie angehangen. allerdings als txt umbenannt