473,805 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5267
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****@TAKEAWA Ycsd.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_fi le.bin", ios_base::binar y);
unsigned char byte;
while (inp_file.get(b yte))
{
cout << hex << static_cast<uns igned 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.l earn.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
11743
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 SQL_Latin1_General_CP1_CI_AS (default). For example the content of the field is: (0xB4F5000000000000) in unicode and defined as varbinary(8).
3
6897
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 using fprintf. The problem is that I don't know how to convert a field of 6 octets? Should I use a long variable? Thanks
2
3547
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
2195
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 binary data (actually some custom file formats). I used to do this a lot in PHP, but i can't understand how this works in C#. in PHP i could do this:
2
17048
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
1597
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 am on 32 bit system, but i am using an Unsigned Integer poiter (UIntPtr) so i Should be able to access 2GB-4GB adresses, except i don't. the functions just dont work. what do i need to do to make it work? thanks.
2
3700
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 finally we have to convert the resultant decimal into hexadecimal. Is it right? Give your suggestion.
5
2367
by: lokeshrajoria | last post by:
hello, how to convert binary to hexa decimal..... thanks & regards lokiiiii
1
2261
by: hpbrothers | last post by:
How to declare hexa & octadecimals data types in c++
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.