Description
This is a basic file reader program which will open and read every byte in the file
specified by the user and will write the output in either ASCII hex value or binary
value representation for each byte as well as it?s 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).
CS530, Spring 2022, Program Assignment #1
Mon, 17 Jan 2022
You shall develop, test, and deliver a program which will print contents of a
regular file in hexadecimal or binary format. The program shall be named xed.
This is a basic file reader program which will open and read every byte in the file
specified by the user and will write the output in either ASCII hex value or binary
value representation for each byte as well as it?s printable (human-readable)
character (characters, digits, symbols) to standard output. For bytes forming nonprintable 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
0003550: 0008 0107 0000 0131 0675 6e73 6967 6e65
…unsigned char
…….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
Example binary output:
0003540: 00000101 00000100 00000110 01110101 01101110 01110011
0003546: 01101001 01100111 01101110 01100101 01100100 00100000
…uns
igned
Create directory ~/a1 by hand on edoras in your class account. Then create C++ (or
C) source file(s), an include file, a Makefile, and a README file, put them into
~/a1.
Note, your xed program will only open regular file type (containing binary or
text/ASCII content), you are not required to handle other file types or errors
encountered if the user attempted to run your xed program is used with other file
types (dir, special, link, pipe).
Suggestion ? become familiar with the xxd program on edoras; your simpler xed
program is similar to running xxd with no options or with the ?b? (binary) option.
Running your xed program: You will build your program such that the xed program
will be launched as follows from the shell?s command line:
edoras% xed
edoras% xed ?b
the first example will cause your xed program to read and print the file specified
by in ASCII/hex format (see above), the second example will cause your
xed program to read and print the file specified by in binary format
(see above).
ADDITIONAL REQUIREMENTS:
README file – you shall create a README file; consult the instructions for README
file content on the course in Canvas. Also, your source files SHALL CONTAIN
sufficient comments for making the source easy to read. Points will be taken off
for poorly (or non) commented source or inadequate README file documentation.
Compiler and Make ? You shall use C++ (or C)(g++/gcc on edoras) compiler to compile
your project. You will also the make program to direct the compilation of your
project for this assignment which will require you to create a Makefile. If you do
not have experience with make, consult the example Reference Module in the course
on Canvas. The name of the executable needs to be to ?xed?.
Project teams. This project is individual work. You may discuss ideas and
challenges with friends and other students but all work must be your own (do not
share files in whole or any parts).
TURNING IN YOUR WORK:
See Canvas for due date.
When ready to turn this in, make sure your files are ready for testing on edoras
and turn-in your README file using Canvas Assignment turnin feature..upload your
README file and also upload a tarball/zipfile with yousource code file(s), and any
additional files to be graded for this assignment.
Purchase answer to see full
attachment