fputs
output a line to a stream
You're viewing an older version of this page (#3267). View the current version.
NAME
<span class="Nm" id="fputs">fputs</span>, <span class="Nm" id="puts">puts</span>
INTERFACE
#include <stdio.h> int fputs ( const char *str, FILE *stream ) int puts ( const char *str )
DESCRIPTION
The function fputs writes the string pointed to by \c str to the stream pointed to by \c stream. \n \n The function puts writes the string \c str, and a terminating newline character, to the stream <span class="Dv">stdout</span>.
RETURN VALUES
The fputs function returns 0 on success and <span class="Dv">EOF</span> on error; puts returns a nonnegative integer on success and <span class="Dv">EOF</span> on error.
ERRORS
<table cellspacing="0" class="refpage" style="margin-left:25px"> <tr> <td valign="top" nowrap> [<span class="Bq"><span class="Er">EBADF</span></span>] </td> <td valign="top"> The \c stream argument is not a writable stream. </td> </tr> </table> \n \n The functions fputs and puts may also fail and set <span class="Va">errno</span> for any of the errors specified for the routines reference:write (2) .
SEE ALSO
ferror (3) , reference:fputws (3) , putc (3) , reference:stdio (3)
STANDARDS
The functions fputs and puts conform to While not mentioned in the standard, both fputs and puts print '<span class="Qlq">(null)</span>' if \c str is <span class="Dv">NULL</span>.