Author Topic: Hex Editing  (Read 2402 times)

dean

  • Community Member
  • Posts: 6
  • Hero Points: 0
Hex Editing
« on: April 05, 2007, 06:24:52 AM »
I'm trying to use Hex Mode to view the contents of a tiff file.  I would like to format the hex output on the screen to have 128 bytes per line.  I'm a newbie to SlickEdit and haven't purchased the product yet and I'm evaluating what I can and can't do with it.  I've read someing about VSP_HEXNOFCOLS but I haven't been able to set this property from the command line because I'm not sure of how to do it.

Is there a way to set the number of 4 byte columns to 32 so that I can get 128 bytes per line in hex mode?

And, since this is a tiff file that I am viewing, I would also like to offset the viewing of the hex on the screen by 8 bytes from the beginning of the tiff file's contents.  The first 8 bytes of the tiff file are header information.

And, finally, is there a way to separate the 4 byte columns into 1 byte columns with a single space between each column?

dean

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: Hex Editing
« Reply #1 on: April 05, 2007, 06:29:30 AM »
Maybe there is a way to write a Macro in Slick-C to view the contents of a binary file (like a tiff file) with the formatting that I need.

Could someone also comment on whether that is possible?

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 731
  • Hero Points: 59
Re: Hex Editing
« Reply #2 on: April 05, 2007, 12:56:25 PM »
Here's a real quick and dirty macro:
Code: [Select]
_command void hex_columns(int columns = 4) name_info(','VSARG2_CMDLINE|VSARG2_REQUIRES_EDITORCTL)
{
   p_hex_Nofcols = columns;
}

Save that to a file and use Macros > Load Module.... to load macro.

Then, you can call it from SlickEdit command-line:

hex-columns 8

or

hex-columns

to reset to the default. 

There may be a few unforeseen issues that may pop up (scroll-bar issues possibly) when changing column width, which is why it's not more publicly exposed.  I'll file a feature request to make it a more accessible option.

dean

  • Community Member
  • Posts: 6
  • Hero Points: 0
Re: Hex Editing
« Reply #3 on: April 06, 2007, 03:52:40 AM »
Thank you for the quick macro.  The anomalies of setting the number of columns in hex mode made this feature not very useful, although it did change the number of columns, but the display of the ascii was incorrect and it was just not what I was hoping for.  However, I already use another editor for Hex editing of Tiff files and it is working for me, so this is not an issue for me in my decision to purchase SlickEdit.

The other features of SlickEdit, especially for my programming language of choice: C++, and the C-like macro language that allows me to extend the editor in many ways, outway the fact that hex editing is not as useful as I would like it to be.

I will probably write a macro that will load and display the hex values of a Tiff file the way that I want and need it to be viewed.

Thank you for your prompt reply.