char *fgetfln(stream, limit, lenp) FILE *stream; int limit, *lenp;
char *fgetln(stream)
FILE *stream;
char *cfgetln(stream)
FILE *stream;
char *fgetline(stream, lenp)
FILE *stream;
int *lenp;
char *dogets(line, lenp) char *line; int *lenp;
fgetln (to read without continuations) and cfgetln (to read with continuations and remove leading whitespace) should be used instead when the limit is not needed. Their definitions are:
#define fgetln(fp) fgetfln(fp, -1, (int *)NULL) /* unbounded read */ #define cfgetln(fp) csfgetfln(fp, 1) /* unbounded cont.d read */
fgetline is the 4.4BSD routine. Dogets hacks any newline off the end of line (as determined from the strlen *lenp), adjusts *lenp to match, and returns line.
Fgetfln is intended to provide a reliable mechanism for reading input containing lines of arbitrary length, rather than trusting that no line will be longer than some arbitrary tolerance.
The memory returned by fgetfln must not be returned via free(3); it will be reused by fgetfln. Conversely, the memory returned by csfgetln must be returned via free(3).