output a line to a stream

You're viewing an older version of this page (#3267). View the current version.

View versions (4)

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 &#92;c str to the stream pointed to by &#92;c stream. &#92;n &#92;n The function puts writes the string &#92;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 &#92;c stream argument is not a writable stream. </td> </tr> </table> &#92;n &#92;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 &#92;c str is <span class="Dv">NULL</span>.