473,320 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Read an Hexa file

Hi
When I open an Hexa file I have some weird char like when I open it with
Notepad. I want to open it in a readeable form (ex: "FF25AB") like with
Ultra edit.
Thanks

regards,
Dany
Jul 19 '05 #1
4 5138
Dany> Hi
Dany> When I open an Hexa file I have some weird char like when I open it
with
Dany> Notepad. I want to open it in a readeable form (ex: "FF25AB") like
with
Dany> Ultra edit.

Use Ultra edit to open your Hexa file
Jul 19 '05 #2

"Dany" <da**************@yahoo.fr> wrote in message
news:bf**********@news-reader5.wanadoo.fr...
Hi
When I open an Hexa file I have some weird char like when I open it with
Notepad. I want to open it in a readeable form (ex: "FF25AB") like with
Ultra edit.
Thanks

regards,
Dany


If you want it to look like ultra-edit then you would have to ouptut the
characters yourself with some kind of conversion to go from 255 to FF. What
UltraEdit does is loads in the binary file and then does this conversion to
(slightly more) human readable form. You will not get this in Notepad
without the method I suggested above
Allan
Jul 19 '05 #3

"Dany" <da**************@yahoo.fr> wrote in message
news:bf**********@news-reader4.wanadoo.fr...
Well I can't proceed to any convertion because I havn't number or letter to work with. I only have some box, smiley and other weird character
"Allan Bruce" <ab****@TAKEAWAYcsd.abdn.ac.uk> a écrit dans le message de
news:bf**********@news.abdn.ac.uk...

"Dany" <da**************@yahoo.fr> wrote in message
news:bf**********@news-reader5.wanadoo.fr...
Hi
When I open an Hexa file I have some weird char like when I open it with Notepad. I want to open it in a readeable form (ex: "FF25AB") like with Ultra edit.
Thanks

regards,
Dany


If you want it to look like ultra-edit then you would have to ouptut the
characters yourself with some kind of conversion to go from 255 to FF.

What
UltraEdit does is loads in the binary file and then does this conversion

to
(slightly more) human readable form. You will not get this in Notepad
without the method I suggested above
Allan



I dont understand, if you mean you have a file which is in this mode at the
moment, then I suggest you read the file in a c++ program in binary mode.
Perhaps storing the contents as an array of unsigned chars. Then carry out
a conversion on each one.
Each unsigned char will be 0-255 which if you divide by 16 will get the
first hex digit (e.g. if it is 10 then the hex digit will be A).
Now if you subtract the (first digit)*16 from the unsigned char, you will be
left with the second digit. Now you can output this in a stream of hex
characters just like ultra-edit
Allan
Jul 19 '05 #4
Dany wrote:
Hi
When I open an Hexa file I have some weird char like when I open it with
Notepad. I want to open it in a readeable form (ex: "FF25AB") like with
Ultra edit.
Thanks

regards,
Dany

There is a tool in the Unix world, "od" or octal dump, which can
display a binary file in human readable form.

Many editors, such as XEmacs and Codewright, can display binary
files in human readable form.

Or you can write a utility which will read a file and output
the human readable format:
#include <fstream>
using namespace std;

int main(void)
{
ifstream inp_file("my_file.bin", ios_base::binary);
unsigned char byte;
while (inp_file.get(byte))
{
cout << hex << static_cast<unsigned short>(byte)
<< ' ';
}
cout << endl;
return 0;
}
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Adam | last post by:
Hello, I'm trying to decifer the data in the table that stores the data in the binary format. All numbers are placed in varbinary fields. All I know is the MS SQL 2000 database useing collation...
3
by: Golan | last post by:
Hello, I have a hexa file which I need to convert to decimal. I use memcpy into variables (char for one octet, short for 2 octets and int for 4 octets) and then print the value into the file by...
2
by: [Gho] | last post by:
How to convert a Hexa value to negative and non negative value : if i get 0x1d = result should be 29 but if i get fd = result should be -3 How to do that
6
by: Natan Vivo | last post by:
Ok, let me explain this first. I did a search about 'hexadecimal' first and found a lot of threads about it, but none of them tell me what i want to know. I am new to C#, and want to work with...
2
by: Nadav | last post by:
Hi, How can I use C# to print a number in hexadecimal e.g. printf(" %x "); or print 15 ( decimal ) as 'F' (hexa) Can a number be printed as binary as-well? Thanks in advance, Nadav.
2
by: Alex | last post by:
Seems that those functions can't read from or write to any address beyond 2GB (7FFFFFFF in hexa). when trying to access addresses beyond 2GB nothing happens - no action and no exception either. i...
2
by: sarchanakumar | last post by:
Hi friends, I want to write a program to add two hexa-decimal numbers. I know there is no way of direction addtion. My logic is, first convert two hexa-numbers into decimal after that we add and...
5
by: lokeshrajoria | last post by:
hello, how to convert binary to hexa decimal..... thanks & regards lokiiiii
1
by: hpbrothers | last post by:
How to declare hexa & octadecimals data types in c++
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.