2004-11-03 13:51:07 +00:00
|
|
|
.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" License.
|
|
|
|
.\" Modified Sat Jul 24 18:42:59 1993 by Rik Faith (faith@cs.unc.edu)
|
|
|
|
.TH PUTS 3 1993-04-04 "GNU" "Linux Programmer's Manual"
|
|
|
|
.SH NAME
|
|
|
|
fputc, fputs, putc, putchar, puts \- output of characters and strings
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <stdio.h>
|
|
|
|
.sp
|
|
|
|
.BI "int fputc(int " c ", FILE *" stream );
|
2006-07-20 16:16:51 +00:00
|
|
|
.br
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int fputs(const char *" "s" ", FILE *" "stream" );
|
2006-07-20 16:16:51 +00:00
|
|
|
.br
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int putc(int " c ", FILE *" stream );
|
2006-07-20 16:16:51 +00:00
|
|
|
.br
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int putchar(int " c );
|
2006-07-20 16:16:51 +00:00
|
|
|
.br
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int puts(const char *" "s" );
|
|
|
|
.SH DESCRIPTION
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the character
|
|
|
|
.IR c ,
|
|
|
|
cast to an
|
2006-02-09 20:24:53 +00:00
|
|
|
.IR "unsigned char" ,
|
2004-11-03 13:51:07 +00:00
|
|
|
to
|
|
|
|
.IR stream .
|
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputs ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the string
|
|
|
|
.I s
|
|
|
|
to
|
|
|
|
.IR stream ,
|
|
|
|
without its trailing
|
|
|
|
.BR '\e0' .
|
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR putc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
is equivalent to
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR fputc ()
|
2004-11-03 13:51:07 +00:00
|
|
|
except that it may be implemented as a macro which evaluates
|
|
|
|
.I stream
|
|
|
|
more than once.
|
|
|
|
.PP
|
|
|
|
.BI "putchar(" c );
|
|
|
|
is equivalent to
|
|
|
|
.BI "putc(" c , stdout ).
|
|
|
|
.PP
|
2005-10-19 07:07:02 +00:00
|
|
|
.BR puts ()
|
2004-11-03 13:51:07 +00:00
|
|
|
writes the string
|
|
|
|
.I s
|
|
|
|
and a trailing newline
|
|
|
|
to
|
|
|
|
.IR stdout .
|
|
|
|
.PP
|
|
|
|
Calls to the functions described here can be mixed with each other and with
|
|
|
|
calls to other output functions from the
|
|
|
|
.B stdio
|
|
|
|
library for the same output stream.
|
|
|
|
.PP
|
|
|
|
For non-locking counterparts, see
|
|
|
|
.BR unlocked_stdio (3).
|
|
|
|
.SH "RETURN VALUE"
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR fputc (),
|
|
|
|
.BR putc ()
|
2005-10-19 07:29:28 +00:00
|
|
|
and
|
|
|
|
.BR putchar ()
|
2004-11-03 13:51:07 +00:00
|
|
|
return the character written as an
|
2006-02-09 20:24:53 +00:00
|
|
|
.I unsigned char
|
2004-11-03 13:51:07 +00:00
|
|
|
cast to an
|
2006-02-09 20:24:53 +00:00
|
|
|
.I int
|
2004-11-03 13:51:07 +00:00
|
|
|
or
|
|
|
|
.B EOF
|
|
|
|
on error.
|
|
|
|
.PP
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR puts ()
|
|
|
|
and
|
2005-10-19 07:29:28 +00:00
|
|
|
.BR fputs ()
|
2004-11-03 13:51:07 +00:00
|
|
|
return a non-negative number on success, or
|
|
|
|
.B EOF
|
|
|
|
on error.
|
|
|
|
.SH "CONFORMING TO"
|
2006-08-03 13:57:30 +00:00
|
|
|
C89, C99
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH BUGS
|
|
|
|
It is not advisable to mix calls to output functions from the
|
|
|
|
.B stdio
|
2005-07-06 07:41:37 +00:00
|
|
|
library with low-level calls to
|
2007-05-12 01:02:19 +00:00
|
|
|
.BR write (2)
|
2004-11-03 13:51:07 +00:00
|
|
|
for the file descriptor associated with the same output stream; the results
|
|
|
|
will be undefined and very probably not what you want.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR write (2),
|
|
|
|
.BR ferror (3),
|
|
|
|
.BR fopen (3),
|
2006-02-09 20:57:44 +00:00
|
|
|
.BR fputwc (3),
|
|
|
|
.BR fputws (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR fseek (3),
|
|
|
|
.BR fwrite (3),
|
|
|
|
.BR gets (3),
|
2006-02-09 20:57:44 +00:00
|
|
|
.BR putwchar (3),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR scanf (3),
|
|
|
|
.BR unlocked_stdio (3)
|