PR/9359: Chris Demetriou: Document fread/fwrite mixing behavior.

This commit is contained in:
christos 2008-12-19 20:20:48 +00:00
parent dcf705893e
commit a41cd06ba5
1 changed files with 13 additions and 2 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fread.3,v 1.12 2003/08/07 16:43:25 agc Exp $
.\" $NetBSD: fread.3,v 1.13 2008/12/19 20:20:48 christos Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)fread.3 8.2 (Berkeley) 3/8/94
.\"
.Dd March 8, 1994
.Dd December 19, 2008
.Dt FREAD 3
.Os
.Sh NAME
@ -70,6 +70,17 @@ bytes long, to the stream pointed to by
.Fa stream ,
obtaining them from the location given by
.Fa ptr .
.Pp
Mixing
.Fn fread
and
.Fn fwrite
calls without setting the file position explicitly using
.Fn fsetpos
between read and write or write and read operations will lead to unexpected
results because of buffering the file pointer not being set to the
expected position after each operation completes.
This behavior is allowed by ANSI C for efficiency and it will not be changed.
.Sh RETURN VALUES
The functions
.Fn fread