-.\" $OpenBSD: fgetln.3,v 1.17 2015/01/13 14:02:30 schwarze Exp $
+.\" $OpenBSD: fgetln.3,v 1.18 2017/07/04 15:33:03 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: January 13 2015 $
+.Dd $Mdocdate: July 4 2017 $
.Dt FGETLN 3
.Os
.Sh NAME
.Ft char *
.Fn fgetln "FILE *stream" "size_t *len"
.Sh DESCRIPTION
+Using this function is error-prone in multiple ways;
+consider using the safer and more portable function
+.Xr getline 3
+instead.
+.Pp
The
.Fn fgetln
function returns a pointer to the next line from the stream referenced by
.Xr realloc 3 .
.Sh SEE ALSO
.Xr ferror 3 ,
+.Xr fgetc 3 ,
.Xr fgets 3 ,
.Xr fopen 3 ,
.Xr fparseln 3 ,
-.Xr putc 3
+.Xr getline 3
.Sh HISTORY
The
.Fn fgetln
printf("%s\en", buf);
}
free(lbuf);
+ if (ferror(fp))
+ err(1, "fgetln");
.Ed