COSC 226 C++ ProgrammingToday'scheck-in task will be to write a special version of the "od" bash utility. "od" stands for "octal dump", but there are switches to dump bytes as hex digits. For example,...


COSC 226 C++ Programming




Today's


check-in task will be to write a special version of the "od" bash utility. "od" stands for "octal dump", but there are switches to dump bytes as hex digits. For example, a text file containing "This is a test!" has the following dump:





COSC226$ od -t x1 test.txt




00000000 54 68 69 73 20 69 73 20 61 20 74 65 73 74 21 0a





Our task is to write this in C++, using concepts from Chapter 11. A good set of starter code is given on page 391 (in section 11.3.2 Binary Files). We will also need to utilize hex output and the directive to set the fill value to a '0' to fill the leading zero hex digits. Write output to the screen, not a file. Dump a file that is longer than the example above so that the output grows to multiple lines. (Note that we don't yet know how to grab a parameter from the cmdline, so a prompt for file is OK).




You will need to grab the as_bytes() function from std_lib_facilities.h (but do not use std_lib_facilities.h in you code).




Turn in your source code and a screenshot of the output of the od command, as well as your program's output.




Work together or alone, but turn in your own version. Go!
Oct 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here