![]() |
![]()
| ![]() |
![]()
NAMEreadline - read line of arbitrary size from file SYNOPSIS# include <stdio.h> # include <begemot.h> char * readline(FILE * fp); int readlinecnt; DESCRIPTIONThis function allows you to read lines of arbitrary length from an input file. It thus overcomes the problem of ``how large should I allocate the input buffer?'' in many programs. It handles the convention of signaling line continuation with a backslash in the last position, i.e. it silently removes sequences of ``\\\n'' from input. The variable readlinecnt contains the number of input lines which where folded together for the last line returned by readline. RETURN VALUEThe function returnes a pointer to a malloc(3C)ed area on success. If end of file or an error is encountered before any character is transfered to the buffer, NULL is returned. readline(l) uses xrealloc(l) to allocate the buffer and thus exists with panic(l) in the case of insufficient memory. SEE ALSOpanic(l), xrealloc(l)
|