cat.cpp updated to use a buffer and tested for speed