1 /******************************************************************************/
2 /*                                                                            */
3 /*     D U M P   F I L E   I N   H E X A D E C I M A L   N O T A T I O N      */
4 /*                                                                            */
5 /******************************************************************************/
6 /* Author:       Richard De Moliner (demoliner@isi.ee.ethz.ch)                */
7 /*               Signal and Information Processing Laboratory                 */
8 /*               Swiss Federal Institute of Technology                        */
9 /*               CH-8092 Zuerich, Switzerland                                 */
10 /* Created:      November 16, 1993                                            */
11 /* System:       SUN SPARCstation, SUN acc ANSI-C-Compiler, SUN-OS 4.1.3      */
12 /******************************************************************************/
13 /* Usage:        dumphex inFile                                               */
14 /******************************************************************************/
15 #include <stdio.h>
16 #include "idea.h"
17 
18 #ifdef ANSI_C
main(int argc,char * argv[])19   int main(int argc, char *argv[])
20 #else
21   int main(argc, argv)
22   int argc;
23   char *argv[];
24 #endif
25 
26 { int count, ch;
27   FILE *inFile;
28 
29   if (argc != 2) { fprintf(stderr, "Usage: dumphex inFile\n"); return -1; }
30   if ((inFile = fopen(argv[1], "rb")) == NULL) { perror(argv[1]); return -1; }
31   for (count = 0; (ch = fgetc(inFile)) != EOF; count++) {
32     if ((count % 16) == 0) printf("\n ");
33     printf(" %02x", ch);
34   }
35   printf("\n\n");
36   return 0;
37 }
38