void hexdump(DWORD, char far *);

void hexdump(DWORD dmplen, char far *dmpptr)

{
 char far *next_chr;
 DWORD still_left;
 long ctr = 0;
 unsigned char sav_chr[17];
 unsigned int  ix;
 unsigned int  iy;
 unsigned char h1[2];
 char buffer[100];
unsigned int dmp_len = 16;
FILE    *pDumpLog;
char dumpfile[30]="ACRODEMO.DMP"; 

 pDumpLog = fopen(dumpfile,"a"); /* Open the file for appending */
 next_chr = dmpptr;
 still_left = dmplen;

 while (still_left > 0)

 {
  if (dmp_len > still_left)
    dmp_len = still_left;
  sprintf(buffer,"\n%06X ",ctr);
  fputs(buffer,pDumpLog);          /* Write the message buffer */
  for (ix=0;ix<16;ix++)
   sav_chr[ix] = 0;
  for (ix=0;ix<dmp_len;ix++)
   sav_chr[ix] = next_chr[ix];

  sav_chr[dmp_len] = '\0';
  next_chr = next_chr + 16;
  for (ix=0;ix<4;ix++)
   {
    for (iy=0;iy<4;iy++)
     {
      h1[0] = sav_chr[ix*4+iy];
      h1[1] = 0;
     sprintf(buffer,"%02X",h1[0]);
     fputs(buffer,pDumpLog);          /* Write the message buffer */
     }
    sprintf(buffer," ");
    fputs(buffer,pDumpLog);          /* Write the message buffer */
   }
  ctr = ctr + 16;
  for (ix=0;ix<16;ix++)
  {
   if (sav_chr[ix] < ' ')
    sav_chr[ix] = '.';
  }
  sprintf(buffer,"*%-16s*",sav_chr);
  fputs(buffer,pDumpLog);          /* Write the message buffer */
  still_left = still_left - dmp_len;
 }
  sprintf(buffer,"\n");
  fputs(buffer,pDumpLog);          /* Write the message buffer */
  fclose(pDumpLog);              /* Close the log file */
}