473,394 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,394 software developers and data experts.

Usage of Hext Dump in C programming

I want to know what is Hex Dump? I tried to search in google but
didn't get useful results. I know it is the hexademical representation
of something. But I don't know what is something? From C programmer's
perspective,
I always hear this term. But when do we need to use hex dump? what's
the importances of hex dump?

please advise. thanks!!
Nov 14 '05 #1
7 2394
Matt wrote on 29/07/04 :
I want to know what is Hex Dump?


It has nothing do do with C programming. It's just a way of
representing some memory area. Hex stands for 'hexadecimal', I presume.

FOr example, say that we have an int with the value 0x1234:

int n = 0x1234;

an 'hex dump' of n will give the memory representation of the value on
the current platform.

For example:

"34 12" on a x86 16-bit
"34 12 00 00" on a x86 32-bit
"00 00 12 34" on a 68000

etc.

Of course you can write a C-function that does the job of converting
the data area (address, length) into an hexadecimal representation.

void hexdump (void *p_data, size_t length)
{
/* now it's your turn to work on! */
}

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #2
jr********@hotmail.com (Matt) wrote:
I want to know what is Hex Dump? I tried to search in google but
didn't get useful results. I know it is the hexademical representation
of something. But I don't know what is something?


Something can be anything that has a memory or disk representation. A
hexdump is simply a display of all the bytes in the object or file, as
hexadecimal values. Pretty trivial to write, usually.

Richard
Nov 14 '05 #3
On Thu, 28 Jul 2004, Matt wrote:
I want to know what is Hex Dump? I tried to search in google but
didn't get useful results. I know it is the hexademical representation
of something. But I don't know what is something? From C programmer's
perspective,
I always hear this term. But when do we need to use hex dump? what's
the importances of hex dump?


A hex dump is a utility to display the contents of memory or a file in a
grid of hexidecimal values. It typically has something like:

OFFSET: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
OFFSET: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
OFFSET: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
OFFSET: 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF

Where OFFSET is the offset from start of the file or it is a memory
address. The rest of the information is the hexidecimal values at those
locations.

It is useful for examining binary data. If I am using something like fread
and fwrite to read and write structures, I can do a hex dump to examine
the data and see what it looks like. It is a fast way to see if some of
the data is not getting generated properly.

--
Send e-mail to: darrell at cs dot toronto dot edu
Don't send e-mail to vi************@whitehouse.gov
Nov 14 '05 #4
(supersedes <mn***********************@YOURBRAnoos.fr>)

Matt wrote on 29/07/04 :
I want to know what is Hex Dump?


It has nothing do do with C programming. It's just a way of
representing some memory area. Hex stands for 'hexadecimal', I presume.

For example, say that we have an int with the value 0x1234:

int n = 0x1234;

an 'hex dump' of n will give the memory representation of the value on
the current platform.

For example:

"34 12" on a x86 16-bit
"34 12 00 00" on a x86 32-bit
"00 00 12 34" on a 68000

etc.

Of course you can write a C-function that does the job of converting
the data area (address, length) into an hexadecimal representation.

void hexdump (void *p_data, size_t length)
{
/* now it's your turn to work on! */
}

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #5

"Matt" <jr********@hotmail.com> wrote in message
I want to know what is Hex Dump? I tried to search in google but
didn't get useful results. I know it is the hexademical representation
of something. But I don't know what is something?
Other people have answered this.
From C programmer's perspective,I always hear this term.
C allows direct manipulation of memory bits, and also hexadecimal constants
eg
int x = 0xFEED;

So though strictly a hex dump has nothing to do with C, it is something that
you might need to when C programming.
But when do we need to use hex dump? what's the importances of hex dump?
A typical use would be this. You have a file which you know is a image, but
someone has lost the format. You also have, for the sake of argument, a
graphics editor which generates files in this format.
What do you do? Well a reasonable strategy would be to create a completely
black image, then hex dump the file. The hex dump is

00 64 00 32 00 00 00 00 00 ... (all zeroes)

We know that the image is 100 pixels wide and 50 pixels high. So it is
pretty obvious that the format is width (16 bits big-endian), height (16
bits big-endian) pixel data. We can generate more images to double-check.
please advise. thanks!!

Nov 14 '05 #6
On Thu, 29 Jul 2004 08:02:20 +0200, Emmanuel Delahaye
<em***@YOURBRAnoos.fr> wrote:
Matt wrote on 29/07/04 :
I want to know what is Hex Dump?
It has nothing do do with C programming. It's just a way of
representing some memory area. Hex stands for 'hexadecimal', I presume.

FOr example, say that we have an int with the value 0x1234:

int n = 0x1234;

an 'hex dump' of n will give the memory representation of the value on
the current platform.

For example:

"34 12" on a x86 16-bit
"34 12 00 00" on a x86 32-bit

I like this
"00 00 12 34" on a 68000

more than this

exist this?

43 21 00 00

Nov 14 '05 #7
jr********@hotmail.com (Matt) writes:

Eric S. Raymond has a simple EBCDIC hexdump in his personal site:

http://www.catb.org/~esr/hexdump/

Give a look at the code, it might help you.
Regards,
--
Gustavo G. Rondina
http://gustgr.freeshell.org
Nov 14 '05 #8

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

Similar topics

7
by: kim | last post by:
Hi All, I had two Window NT 4.0 Server, say A and B... We recently upgraded from MS SQL Server 6.5 to MS SQL Server 2000 on Computer A, and for Computer B, I installed SQL Server 2000 from...
4
by: Matt | last post by:
I want to know what is Hex Dump? I tried to search in google but didn't get useful results. I know it is the hexademical representation of something. But I don't know what is something? From C++...
0
by: Clemens Hintze | last post by:
Hello, I have a question concerning the usage of default constructed std::slice instances. Our company currently validate the GNU-G++ 3.4 compiler against the ISO/IEC 14882:2003 standard for...
1
by: Damien | last post by:
Hi guys, I'm looking for ideas for troubleshooting the following. We've tried some random things to try to treat the symptoms, but none seem robust enough to use when we go live, and we'd rather...
9
by: Shivam | last post by:
Hi All, I have a mysql dump file... something like. __________________________________________________ CREATE TABLE nation ( ip int(11) unsigned NOT NULL default '0', country char(2) NOT...
1
by: | last post by:
weve installed our asp.net 11. (32 bit) web app on windows 2002 64 bit server running under 32 bit emulation mode. should work ok, but were seeing cpu at 100%, but the server is a qaud dual core...
1
by: Frank Rizzo | last post by:
I have an application (windows service) that in the beginning reads data rapidly into a collection of large object trees. Each object tree in the collection is about 100mb and typically there are...
2
by: erfan | last post by:
Hi,comp.c: I try to learn malloc,facing a problem like this: -------- #include<unistd.h> #include<stdlib.h> #include<stdio.h> int main(void) {
1
by: Max2006 | last post by:
Hi, To protect my WCF service boundaries, I assign a unique support ticket to all server side exceptions, log them and send a general FaultException to client that only include the support...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.