Janine Sisk wrote:
I have never had to edit a binary file, but how bad can it be? (note to self - make copy first :)

Below is a little C program I wrote the last time I had to fix a dump file. Run it with

  dmp-charset <broken.dmp >fixed.dmp


/*

  Change the two bytes denoting the character set in
  an Oracle dump file. This is stored in byte 2 and 3.

  0x001f = WE8ISO8859P1

  Compile with: gcc -o dmp-charset dmp-charset.c

 */

#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char **argv)
{
  char buf[16384];
  int i, l;

  while (l = read(0, buf, 16384)) {
    if (i == 0) {
      buf[1] = 0x00;
      buf[2] = 0x1f;
      i = 1;
    }

    write(1, buf, l);
  }
}


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to