Update chain.cpp

http://stackoverflow.com/questions/745897/reading-parts-of-an-input-file