.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" License.
-.TH GETLINE 3 2009-12-05 "GNU" "Linux Programmer's Manual"
+.TH GETLINE 3 2010-06-12 "GNU" "Linux Programmer's Manual"
.SH NAME
getline, getdelim \- delimited string input
.SH SYNOPSIS
.br
.BR getline (),
.BR getdelim ():
-_POSIX_C_SOURCE >= 200809 || _XOPEN_SOURCE >= 700
+_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
.SH DESCRIPTION
.BR getline ()
reads an entire line from \fIstream\fP,
.BR getline ()
will allocate a buffer for storing the line,
which should be freed by the user program.
-(The value in
+(In this case, the value in
.I *n
is ignored.)
This value can be used
to handle embedded null bytes in the line read.
-Both functions return \-1 on failure to read a line (including end of file
+Both functions return \-1 on failure to read a line (including end-of-file
condition).
.SH ERRORS
.TP
int
main(void)
{
- FILE * fp;
- char * line = NULL;
+ FILE *fp;
+ char *line = NULL;
size_t len = 0;
ssize_t read;
printf("%s", line);
}
- if (line)
- free(line);
+ free(line);
exit(EXIT_SUCCESS);
}
.fi