![]() |
![]()
| ![]() |
![]()
NAMExt_ff_gets_malloc() - Read a line from a fast file stream, allocating memory as needed LIBRARY#include <xtend/fast-file.h> -lxtend SYNOPSISint xt_ff_gets_malloc(xt_ff_t *stream, char **buff, size_t *buff_size, size_t *len) ARGUMENTSstream: xt_ff_t stream from which field is read buff: Character buffer into which field is copied buff_size: Size of the array passed to buff (must be initialized!) len: Pointer to a variable which will receive the string length DESCRIPTIONxt_ff_gets_malloc(3) reads a single line of text (up to the next newline or EOF) from stream, allocating and/or extending the provided buffer if needed. The argument buff_size must be initialized to the size of buff before being passed in. This should be 0 if buff does not point to allocated memory. It is updated to the new size if xt_ff_gets_malloc() allocates or extends buff. The len argument is set to the length of the string read into buff. Len may be less than or equal to buff_size-1 upon return. RETURN VALUESDelimiter ending the read: either newline or EOF EXAMPLESxt_ff_t *stream; char *buff; size_t buff_len, len; while ( xt_ff_ile_read_line_malloc(stream, buff, &buff_len, &len) != EOF ) { } SEE ALSOxt_dsv_read_field_malloc(3), xt_ff_getc(3)
|