home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / OS2UTIL.ZIP / HEX.C < prev    next >
Text File  |  1990-05-21  |  432b  |  29 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(int argc, char **argv);
  5.  
  6. main(argc, argv)
  7. int argc;
  8. char **argv;
  9. {
  10.     unsigned long hex;
  11.     int i;
  12.  
  13.     if (argc < 2) {
  14.     puts("format: hex hex-number [hex-number] [hex-number] . . . ");
  15.     return -1;
  16.     }
  17.     else
  18.     {
  19.     for (i = 1; i < argc; i++)
  20.     {
  21.         sscanf(argv[i], "%lx", &hex);
  22.         printf("%lx h = %lu\n", hex, hex);
  23.     }
  24.     }
  25.  
  26.     return 0;
  27. }
  28. 
  29.