Re: Bit and Byte readers?
> I've read the man od information, but I am not seeing how to change the
> granularity. What am I missing?
>
I guess a small C program is the easiest
Adjust to your liking.
Eric
#include <stdio.h>
int main(int argc, char *argv[])
{
FILE *fp;
char byte;
int i, j =0;
if (argc == 2)
fp = fopen(argv[1], "r");
while (fp && !feof(fp) && !ferror(fp))
{
if ((byte = fgetc(fp)) != EOF)
{
fprintf(stdout, "byte %d : ", j++);
for (i = 7; i >= 0; i--)
{
fprintf(stdout, "%d", (byte >> i) & 0x01);
}
fprintf(stdout, "\n");
}
}
if (fp)
fclose(fp);
return 0;
}
|