SYNOPSIS
#define _WITH_GETLINE
#include <stdio.h>
ssize_t getdelim(char **linep, size_t *linecapp, int delimiter, FILE *stream);
ssize_t getline(char **linep, size_t *linecapp, FILE *stream);
DESCRIPTION
The
The caller may provide a pointer to a malloced buffer for the line in
*linep, and the capacity of that buffer in *linecapp. These functions
expand the buffer as needed, as if via
RETURN VALUES
The
These functions may fail if either linep or linecapp is NULL then errno is set to EINVAL, or no delimiter was found in teh first SSIZE_MAX characters in which case errno is set to EOVERFLOW.
These functions may also fail due to any of the errors specified for
EXAMPLE
The following code fragment reads lines from a file and writes them to
standard output. The
char *line = NULL; size_t linecap = 0; ssize_t linelen; while ((linelen = getline(&line, &linecap, fp)) > 0) fwrite(line, linelen, 1, stdout); free(line);
CONFORMANCE
The
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
Many application writers used the name getline before the
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.5 Documentation Build 40.