add io example from TLPI

This is a modified IO example from Michael Kerrisk's book, The Linux
Programming Interface