C++ program which emulates linux cut command