use only one pointer to scan input file