tohex / fromhex
by Winston Jenks <winston@capesoftware.com>

#---------------------------------------------------------------------+
#  Copyright (c) 2000 Winston Jenks. All Rights Reserved.             |
#                                                                     |
#                  http://thecassandraproject.org/                    |
#                                                                     |
#  This is free software; you can redistribute it and/or modify it    |
#  under the terms of the GNU General Public License as published by  |
#  the Free Software Foundation; either version 2 of the License, or  |
#  (at your option) any later version.                                |
#                                                                     |
#  This software is distributed in the hope that it will be useful,   |
#  but WITHOUT ANY WARRANTY; without even the implied warranty of     |
#  merchantability or fitness for a particular purpose. See the GNU   |
#  General Public License (http://www.fsf.org/copyleft/gpl.htm)for    |
#  more details.                                                      |
#                                                                     |
#  To obtain the GNU General Public License, write to:                |
#                                                                     |
#      Free Software Foundation, Inc.                                 |
#      59 Temple Place - Suite 330                                    |
#      Boston, MA  02111-1307                                         |
#      USA                                                            |
#---------------------------------------------------------------------+

The program tohex will take a binary file and convert it to a combination of hex characters and ASCII strings. The idea here is that you can then edit the file en masse with either sed or some such thing. Actually, for most edits, I would suggest UltraEdit, but there are times when this might come in handy. The companion program fromhex will put thehex characters and ASCII strings back into the binary file.

Usage

 

        tohex {binaryfile} > hexfile.txt

 

Note that tohex will read from a file given as its argument and write the hex/ASCII version to stdout.

 

        fromhex {binaryfile} < hexfile.txt

 

Note that fromhex will read from stdin and write its output to the file named on the command line.

Unlike most of my programs this one does not take the -help option to print its usage. Just run either command with no arguments to find out the proper usage.

Download

source code and Solaris binaries (9 KB)

Requirements

Solaris platform; or NT and a C compiler

Author

Winston Jenks <winston@capesoftware.com>
Technical Director
Cape Software, Inc. (www.capesoftware.com)