DEV/DEV1.1/TP12/hexatrash.c

26 lines
359 B
C

#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);
}