74 lines
2.4 KiB
HTML
74 lines
2.4 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>putc(3)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>putc(3)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
putc, putchar, fputc, putw - put character or word on a stream
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><stdio.h></STRONG>
|
|
|
|
<STRONG>int</STRONG> <STRONG>putc(int</STRONG> <EM>c</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>putchar(int</STRONG> <EM>c</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>fputc(int</STRONG> <EM>c</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>putw(int</STRONG> <EM>w</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
<STRONG>Putc</STRONG> appends the character <EM>c</EM> to the named output <EM>stream</EM>. It returns the
|
|
character written.
|
|
|
|
<STRONG>Putchar(</STRONG><EM>c</EM><STRONG>)</STRONG> is defined as <STRONG>putc(</STRONG><EM>c</EM><STRONG>,</STRONG> <STRONG>stdout)</STRONG>.
|
|
|
|
<STRONG>Fputc</STRONG> behaves like <STRONG>putc</STRONG>, but is a genuine function rather than a macro.
|
|
|
|
<STRONG>Putw</STRONG> appends word (that is, <STRONG>int</STRONG>) <EM>w</EM> to the output <EM>stream</EM>. It returns the
|
|
word written. <STRONG>Putw</STRONG> neither assumes nor causes special alignment in the
|
|
file.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man3/fopen.3.html">fopen(3)</A></STRONG>, <STRONG><A HREF="../man3/fclose.3.html">fclose(3)</A></STRONG>, <STRONG><A HREF="../man3/getc.3.html">getc(3)</A></STRONG>, <STRONG><A HREF="../man3/puts.3.html">puts(3)</A></STRONG>, <STRONG><A HREF="../man3/printf.3.html">printf(3)</A></STRONG>, <STRONG><A HREF="../man3/fread.3.html">fread(3)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>DIAGNOSTICS</H2><PRE>
|
|
These functions return the constant <STRONG>EOF</STRONG> upon error. Since this is a good
|
|
integer, <STRONG><A HREF="../man3/ferror.3.html">ferror(3)</A></STRONG> should be used to detect <STRONG>putw</STRONG> errors.
|
|
|
|
|
|
</PRE>
|
|
<H2>BUGS</H2><PRE>
|
|
Because it is implemented as a macro, <STRONG>putc</STRONG> treats a <EM>stream</EM> argument with
|
|
side effects improperly. In particular `putc(c, *f++);' doesn't work
|
|
sensibly.
|
|
|
|
Errors can occur long after the call to <STRONG>putc</STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|