DEV/DEV1.1/TP12/hexatrash.c

26 lines
359 B
C
Raw Normal View History

2022-11-29 11:21:49 +01:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char const *argv[])
{
FILE *f;
f=fopen(argv[1],"r");
int n;
int x=0;
while(feof(f)==0)
{
printf("%06x0 ",x);
for (int i = 0; i < 8; ++i)
{
fread(&n,2,1,f);
if (feof(f)==0)
{
printf("%04x ", n);
}else{break;}
}
x++;
printf("\n");
}
fclose(f);
}