On Sun, 04 Mar 2012, David Laight wrote:
I wonder it it would be worth adding a function that is like gets, but takes a buffer length (ie discards the \n - and maybe the rest of the line).

C2011 has char *gets_s(char *s, rsize_t n);

It discards the \n, but does not discard the rest of the line, so you can't tell the difference between a line that was exactly the maximum length (followed by a \n which is discarded) or a line that was too long. fgets() can tell the difference, however.

--apb (Alan Barrett)

Reply via email to