Homework 5
Hexadecimal Core Dump Utility

Due: Tuesday, December 7 at 5pm

Outcomes

After successfully completing this assignment, you will...

Before Starting

I will not be covering the material on bitwise operators, hexadecimal numbers, or command-line arguments in class. One of the skills you need to develop in order to become successful programmer is to be able to understand and put into practice what you read in a programming manual or textbook. Here are the relevant sections for this assignment:

The Assignment

We talked about the differences between text files and binary files in class. One major difference is that unlike text files, binary files cannot be viewed with a text editor. However, sometimes you want to be able to view the information in a binary file. One way to do this is to run a hex dump utility on the file, which displays each byte in the file as a two-digit hexadecimal value (try running the Linux utility xxd on one of your recent a.out files to see an example of a hex dump utility's output). In this assgnment, you will write a simple version of a hex dump program.

Here are the specifications for the program:

Include files

Hints

Get byteToHex working first. The debugger can be very helpful as you develop this function that uses the C bitwise operators. Write a simple main function to test byteToHex. Once you're sure that byteToHex works, then develop the main function to open a binary file, and call byteToHex to process each byte of the file.

Deliverables

Submit your file using the following turnin command:

/cs/bin/turnin submit cs2301 PROJECT5 hexdump.c byteToHex.h byteToHex.c makefile README

Programs submitted after 5pm on December 7 will be tagged as late, and will be subject to the late homework policy.

Grading

This assignment will be graded on the following areas: documentation (including pre- and post-conditions for any functions), adherence to specifications, and correctness. A grade sheet will be published prior to the homework due date.

Here is the Homework 5 gradesheet.

Programs must compile successfully in order to receive points for correctness.