|
From: Per W. <pw...@ia...> - 2005-07-03 08:59:15
|
I can only guess but...
I would think that you should do something similar to a hex-dump but
instead of emitting the individual bytes as hexadecimal (00..FF) you
should emit them as decimal (0..255).
pos = 0;
for each byte in file {
if ((pos % 10) == 0) { // 10 bytes/line
if (pos) printf("\n");
printf("%08d",pos); // Emit decimal offset in file.
}
printf(" %3d",byte);
pos++;
}
if (pos) printf("\n");
Remember to open the file in binary mode, i.e.
f = fopen("name","rb");
if using C code.
/Per W
On Sun, 3 Jul 2005, Scott wrote:
> Does anyone, or can anyone help me write a simple console app,
> to scan a file and dump or display it's contents as "Decimal 1 byte binary"
> even just some info, on what i would do to view a file as decimal 1byte...
> would help,
>
> i.e
>
> I want to display or dump to a text file something like...
> the following:
> ----------------------------------------------------------------
> 00000020 105 100 0 0 76 65
> 00000040 84 83 0 0 0 0
> 00000060 0 6 86 77 65
> ----------------------------------------------------------------
> Anyone have any links, or where i should be looking for more info,
> i have done google searches without much luck.
>
> Thanks,
>
> Cheers,
> Scott.
>
>
>
|