return value of fprintf

Garrett Wollman wollman at csail.mit.edu
Mon Jan 22 22:46:50 UTC 2007


<<On Mon, 22 Jan 2007 22:31:50 +0100, Køi¹tof ®elechovski <giecrilj at stegny.2a.pl> said:

> The latter is correct: I get printf("abcd") == 4 even under >/dev/full.
> (uname is Interix on x86 ver. 3.5)

The FreeBSD C library is only supported as an integral part of the
FreeBSD operating system.

> However, the former is not: according to the ANSI C standard
> <http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf> , §7.19.6.1/14,
> printf should return a negative value in this case.

The standard makes no such requirement; neither an encoding error nor
an I/O error can ever be encountered in this example.  The error
condition will not be detected until the stream's buffer is flushed,
as by fflush() or fclose().

-GAWollman



More information about the freebsd-standards mailing list