GETDELIM(3)

NAME
getdelim - read a line up to a specified line delimiter

SYNOPSIS

#include <stdio.h>

int getdelim(char **bufptr, size_t *n, int delim, FILE *fp);

DESCRIPTION

getdelim reads a file fp up to and possibly including a specified delimiter delim. The line is read into a buffer pointed to by bufptr and designated with size *n. If the buffer is not large enough, it will be dynamically grown by getdelim. As the buffer is grown, the pointer to the size n will be updated.

RETURNS

getdelim returns -1 if no characters were successfully read; otherwise, it returns the number of bytes successfully read. At end of file, the result is nonzero.

PORTABILITY

getdelim is a glibc extension.

No supporting OS subroutines are directly required.