223 lines
4.5 KiB
HTML
223 lines
4.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of PUTS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>PUTS</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2018-04-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
fputc, fputs, putc, putchar, puts - output of characters and strings
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/stdio.h">stdio.h</A>></B>
|
|
|
|
<B>int fputc(int </B><I>c</I><B>, FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<B>int fputs(const char *</B><I>s</I><B>, FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<B>int putc(int </B><I>c</I><B>, FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<B>int putchar(int </B><I>c</I><B>);</B>
|
|
|
|
<B>int puts(const char *</B><I>s</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>fputc</B>()
|
|
|
|
writes the character
|
|
<I>c</I>,
|
|
|
|
cast to an
|
|
<I>unsigned char</I>,
|
|
|
|
to
|
|
<I>stream</I>.
|
|
|
|
<P>
|
|
|
|
<B>fputs</B>()
|
|
|
|
writes the string
|
|
<I>s</I>
|
|
|
|
to
|
|
<I>stream</I>,
|
|
|
|
without its terminating null byte ('\0').
|
|
<P>
|
|
|
|
<B>putc</B>()
|
|
|
|
is equivalent to
|
|
<B>fputc</B>()
|
|
|
|
except that it may be implemented as a macro which evaluates
|
|
<I>stream</I>
|
|
|
|
more than once.
|
|
<P>
|
|
|
|
<B>putchar(</B><I>c</I><B>)</B>
|
|
|
|
is equivalent to
|
|
<B>putc(</B><I>c</I><B>, </B><I>stdout</I><B>)</B><I></I>.
|
|
|
|
<P>
|
|
|
|
<B>puts</B>()
|
|
|
|
writes the string
|
|
<I>s</I>
|
|
|
|
and a trailing newline
|
|
to
|
|
<I>stdout</I>.
|
|
|
|
<P>
|
|
|
|
Calls to the functions described here can be mixed with each other and with
|
|
calls to other output functions from the
|
|
<I>stdio</I>
|
|
|
|
library for the same output stream.
|
|
<P>
|
|
|
|
For nonlocking counterparts, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+unlocked_stdio">unlocked_stdio</A></B>(3).
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<B>fputc</B>(),
|
|
|
|
<B>putc</B>()
|
|
|
|
and
|
|
<B>putchar</B>()
|
|
|
|
return the character written as an
|
|
<I>unsigned char</I>
|
|
|
|
cast to an
|
|
<I>int</I>
|
|
|
|
or
|
|
<B>EOF</B>
|
|
|
|
on error.
|
|
<P>
|
|
|
|
<B>puts</B>()
|
|
|
|
and
|
|
<B>fputs</B>()
|
|
|
|
return a nonnegative number on success, or
|
|
<B>EOF</B>
|
|
|
|
on error.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>fputc</B>(),
|
|
|
|
<B>fputs</B>(),
|
|
|
|
<B>putc</B>(),
|
|
|
|
<B>putchar</B>(),
|
|
|
|
<B>puts</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008, C89, C99.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
It is not advisable to mix calls to output functions from the
|
|
<I>stdio</I>
|
|
|
|
library with low-level calls to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2)
|
|
|
|
for the file descriptor associated with the same output stream; the results
|
|
will be undefined and very probably not what you want.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ferror">ferror</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fgets">fgets</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fopen">fopen</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fputwc">fputwc</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fputws">fputws</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fseek">fseek</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fwrite">fwrite</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+putwchar">putwchar</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+scanf">scanf</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+unlocked_stdio">unlocked_stdio</A></B>(3)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">ATTRIBUTES</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">BUGS</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="9"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:53 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|