/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>

int main(int argc, char *argv[])
{
   printf("C (text, bytes, ctx=rec) - %s\n", argv[1]);
   FILE *fp = fopen(argv[1], "r");
   int eol;
   int c;
   while((c = fgetc(fp)) >= 0)
   {
      if(c == '\n')
      {
         printf("\n");
         eol = 1;
      }
      else
      {
         printf("%02X", c);
         eol = 0;
      }
   }
   if(!eol) printf("\n");
   fclose(fp);
}
