lq-text: LQU_fReadLine

API int LQU_fReadLine (f, Linep, Flags) FILE *f; char **Linep; int Flags;

Purpose

Reads the next input line from the given file into a static buffer. The buffer is allocated with malloc and resized dynamically, but is owned by LQU_f­Read­Line and should not be free'd or overwritten.

The LQU_Steal­Read­Line­Buffer function can be used to obtain the buffer; LQU_f­Read­Line will allocate a new one the next time it is called.

The given Flags are treated as for LQU_f­Read­File, which currently calls this routine directly. Note that, as for LQU_f­Read­File, blank lines are skipped if the corresponding flag is given. In this case, LQU_f­Read­Line will never return a pointer to a blank line, but will continue reading lines from the file until a non-blank one is found.

Returns

a pointer to the line, in Line, and also the number of bytes in the line; -1 is returned on EOF, in which case the Line pointer should not be used.