The
getdelim() function reads from the
stream until it encounters a character matching
delimiter, storing the input in
*lineptr. The buffer is
NUL-terminated and includes the delimiter. The
delimiter character must be representable as an unsigned char.
If
*n is non-zero, then
*lineptr must be pre-allocated to at least
*n bytes. The buffer should be allocated dynamically; it must be possible to
free(3) *lineptr.
getdelim() ensures that
*lineptr is large enough to hold the input, updating
*n to reflect the new size.
The
getline() function is equivalent to
getdelim() with
delimiter set to the newline character.