CS410 - Networks and Networking - Hamming Code Lab

Fall Semester, 2004


Due in class on Thursday, September 16th, 2004

Write a program to move data from input.dat (see below) to an output file. The four major requirements for this assignment are:

  1. Convert the integers read from input.dat into binary form, stored in a character array using '1's and '0's in the appropriate places.

  2. Write something akin to encode() and decode() to add enough information to the "binary" string so you can both detect and correct single-bit errors using a Hamming code.

  3. Use the transport() function that I provide to "move" your data from place to place. This function is fairly reliable, it won't trash more than one bit during a transmission of a single word and sometimes doesn't trash any bits.

  4. The output file you generate should be identical to the input file.

You can find source code for transport() in ~charliep/courses/networks-networking. If you get stumped on how to do the binary conversion get in touch and I'll walk you through one approach.

Bring a printed copy of your code to class to turn-in. Also print-out a screen-shot showing that your program works as advertised, diff is your friend here.

Please trap and check return codes where necessary. Your code should always be concise, but never at the expense of clarity.

Include in your finished product the ability to enable and disable debugging messages with a single #define or other mechanism. Extra credit will be given for a solution that doesn't involve the pollution of the code with constructs such as:

	#ifdef DEBUG
		/* print some message */
	#endif

For extra credit replace the char array implementation of binary number representation with a bit field or other more efficient data structure. How much space did you save by doing this?

For extra credit if argv[1] is not present than read from stdin and write to stdout.