DragonFly On-Line Manual Pages

Search: Section:  


readline(l)                     BEGEMOT Library                    readline(l)

NAME

readline - read line of arbitrary size from file

SYNOPSIS

# include <stdio.h> # include <begemot.h> char * readline(FILE * fp); int readlinecnt;

DESCRIPTION

This 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 VALUE

The 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 ALSO

panic(l), xrealloc(l) BEGEMOT 30 Aug 1996 readline(l)

Search: Section: