Re: Help - Hexdump of a file

From: lallous (spamtrap_at_crayne.org)
Date: 07/20/04


Date: Tue, 20 Jul 2004 21:46:55 +0000 (UTC)

Hello

This question is not related to x86 assembly, you would get better replies
if you post in comp.programming.

However, here are the steps to create the hexdump utility:

1)Read a chunk of the file (or whole file if possible)
2)Say that your width is N, so convert N bytes from that buffer into a hex
string (a series of hexadecimal representation of each byte in that buffer)
3)print that hex string, then print the actual bytes. You might want to
print '.' in the place of non-printable characters.
4)repeat step 2-3 till the read chunk is totally processed
5)repeat step 1 while the file end is not reached

Try to google around, I am sure there are plenty of examples.

HTH
Elias

"Cutie Khushi" <spamtrap@crayne.org> wrote in message
news:bcfa9182.0407191909.1e1beb46@posting.google.com...
> I am trying to write an assembly language program (unsing turbo
> pascal) which can generate the hemdump of a file (trial.txt). Sample
> Invocation: hexdump trial.txt
>
> I am stuck badly, and dont know what to do. i have code to read the
> file, and print it (one cahracter at a time), and i have also figured
> out how to convert each character to hexadecimal (thouhg i am not sure
> if its right). But i cant put everything together so that the output
> resembles the format of hexdump.
>
> Any help will be appreciated :(