![]() |
Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members
zd.cGo to the documentation of this file.00001 #include <stdio.h> 00002 #include <string.h> 00003 #include <ctype.h> 00004 #include <stdlib.h> 00005 00006 00007 int main(int argc,char *argv[]) 00008 { 00009 FILE *fil; 00010 unsigned char c; 00011 char slask[200]; 00012 int i; 00013 long addr = 0; 00014 00015 if (argc < 2) 00016 { 00017 printf("Usage: %s <file>\n",*argv); 00018 exit(-1); 00019 } 00020 if ((fil = fopen(argv[1],"rb")) != NULL) 00021 { 00022 while (!feof(fil)) 00023 { 00024 printf("%04lx ",addr); 00025 *slask = 0; 00026 for (i = 0; i < 16; i++) 00027 { 00028 fread(&c,1,1,fil); 00029 printf(" %02x",c); 00030 if (isprint(c & 0x7f)) 00031 sprintf(slask + strlen(slask),"%c",c & 0x7f); 00032 else 00033 strcat(slask,"."); 00034 if (i == 7) 00035 { 00036 printf(" "); 00037 strcat(slask," "); 00038 } 00039 } 00040 printf(" %s\n",slask); 00041 addr += 16; 00042 } 00043 fclose(fil); 00044 } else 00045 printf("Couldn't open '%s'...\n",argv[1]); 00046 return 0; 00047 } |