c - read an unknown number of lines -
c - read an unknown number of lines -
i need implement in c programme ,which reads unknown number of lines stdin. know maximum number of lines 100. tried utilize gets ,but don`t know when stop loop. can advise me how implement it?
this depends on when want programme stop. there several mutual approaches:
never: run infinite loop until end-user hits^c or otherwise terminates programme using facilities of operating system until user enters special marker, i.e. "keyword" quit, exit, etc. on line itself until user enters empty line (i.e. hits enter) since max number in case 100, can utilize limit automatically terminate input 1 time max reached.
c input stdin gets
Comments
Post a Comment