Bug report for fputs()

Olivier Langlois Olivier.Langlois@streamtheworld.com
Wed Aug 15 14:18:00 GMT 2007


I am not sure if the return value is defined by the ANSI C standard or if it is an implementation specific feature but all documentation about fputs() return value that I have seen say:

puts() and fputs() return a non-negative number on success, or EOF on error.

Newlib implementation of fputs() returns 0 on success. I have double checked this by looking in the source code and the header comment of function __sfvwrite_r which is used by fputs() seems to confirm this:

/*
 * Write some memory regions.  Return zero on success, EOF on error.
 *
 * This routine is large and unsightly, but most of the ugliness due
 * to the three different kinds of output buffering is handled here.
 */

Greetings,
Olivier Langlois
http://www.olivierlanglois.net



More information about the Newlib mailing list