
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (int argc, char *argv[])

{
FILE		*fpt;
unsigned char	b;
int		i,total_bytes;

if (argc != 2)
  {
  printf("Usage:  bytedump [filename]\n");
  exit(0);
  }
if ((fpt=fopen(argv[1],"rb")) == NULL)
  {
  printf("Unable to open %s for reading\n",argv[1]);
  exit(0);
  }
total_bytes=0;
while (1)
  {
  i=fread(&b,1,1,fpt);
  if (i == 0)
    break;
  printf("Byte %d is %d (%c)\n",total_bytes,b,b);
  total_bytes++;
  }
fclose(fpt);

}
