Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This can be done in C or C++ .You shall develop, test, and deliver a basic hexadecimal file dump program, xbd. The basic hexdump program

This can be done in C or C++.You shall develop, test, and deliver a basic hexadecimal file dump program, xbd.

The basic hexdump program will open a regular type file (containing binary or text/ASCII content), read every byte in the file and write both the ASCII hex value for that byte as well as its printable (human-readable) character (characters, digits, symbols) to standard output. For bytes forming non-printable characters, print a . character (a dot/period character, i.e. hex value 2E).

The output should be formatted:

: 123456789ABCDEF

-- Where B0B1 means Byte #0, Byte #1, etc; the 123456789ABCDEF is the char/digit/symbol in human readable form

Example hex output:

0003540: 0504 0675 6e73 6967 6e65 6420 6368 6172 ...unsigned char

0003550: 0008 0107 0000 0131 0675 6e73 6967 6e65 .......1.unsigne

Your program shall also provide an option to print in binary instead of hex. If the binary option is selected, then the output format shall be:

bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb 123456

-- where b means bit; each line has 6 octets with a space in between each octet

e.g. (output format fragment sample):

0003540: 00000101 00000100 00000110 01110101 01101110 01110011 ...uns

0003546: 01101001 01100111 01101110 01100101 01100100 00100000 igned

Note, your hexdump program will only open regular file type (binary or text/ASCII content), you are not required to handle other file types or errors encountered if the user attempted to run your hexdump program on other file types (dir, special, link, pipe).

ill be launched as follows from the shells command line:

edoras% xbd

edoras% xbd b

the first example will cause your xbd program to dump (print) the file specified by in ASCII/hex format, the second example will cause your xbd program to dump (print) the file specified by in binary format.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions