We have several solutions to the current programming exercise. Here they are:

http://primepuzzle.com/tc/binary_io_program.html (Perl)
http://primepuzzle.com/tc/bindecode.html (Python)
http://primepuzzle.com/tc/BINDECOD.BAS (BASIC)
http://primepuzzle.com/tc/BINDECOD.EXE (BASIC executable)
http://primepuzzle.com/tc/scacalos.tc (tiny-c)
http://primepuzzle.com/tc/bin2ascii.php (PHP - Lorem ipsum - actually runs the program)
http://primepuzzle.com/tc/bin2ascii.html (PHP - Lorem ipsum - shows you source code)
http://primepuzzle.com/tc/bin2asciibas.php (PHP - BASIC source code - actually runs the program)
http://primepuzzle.com/tc/bin2asciibas.html (PHP - BASIC source code - shows you source code)
http://primepuzzle.com/tc/bindecod.htm (Flowchart of BASIC solution)

Click http://primepuzzle.com/tc/not-just-bin.html for more on these programs.

Binary encoded test file : Encoded Lorem ipsum
Its character decoded counterpart : Lorem ipsum

Both the Python and the tiny-c programs can decode and encode.

The Perl and Python solutions will be more useful to you after they are explained but take a look and make note of those areas in the code that you don't understand.