Modified getline routine to use increment rather than pointer math