man-pages/man3/puts.3

123 lines
3.0 KiB
Groff
Raw Normal View History

.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2004-11-03 13:51:07 +00:00
.\"
.\" 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.
.\"
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.
.\"
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 );
2007-12-23 13:45:24 +00:00
2004-11-03 13:51:07 +00:00
.BI "int fputs(const char *" "s" ", FILE *" "stream" );
2007-12-23 13:45:24 +00:00
2004-11-03 13:51:07 +00:00
.BI "int putc(int " c ", FILE *" stream );
2007-12-23 13:45:24 +00:00
2004-11-03 13:51:07 +00:00
.BI "int putchar(int " c );
2007-12-23 13:45:24 +00:00
2004-11-03 13:51:07 +00:00
.BI "int puts(const char *" "s" );
2007-12-23 13:45:24 +00:00
.fi
2004-11-03 13:51:07 +00:00
.SH DESCRIPTION
.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
.BR fputs ()
2004-11-03 13:51:07 +00:00
writes the string
.I s
to
.IR stream ,
without its trailing
2008-06-09 15:49:35 +00:00
.BR \(aq\e0\(aq .
2004-11-03 13:51:07 +00:00
.PP
.BR putc ()
2004-11-03 13:51:07 +00:00
is equivalent to
.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
.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
2007-06-23 07:56:56 +00:00
.I stdio
2004-11-03 13:51:07 +00:00
library for the same output stream.
.PP
For nonlocking counterparts, see
2004-11-03 13:51:07 +00:00
.BR unlocked_stdio (3).
.SH "RETURN VALUE"
.BR fputc (),
.BR putc ()
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
.BR puts ()
and
.BR fputs ()
return a nonnegative number on success, or
2004-11-03 13:51:07 +00:00
.B EOF
on error.
.SH "CONFORMING TO"
C89, C99.
2004-11-03 13:51:07 +00:00
.SH BUGS
It is not advisable to mix calls to output functions from the
2007-06-23 07:56:56 +00:00
.I 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),
.BR fputwc (3),
.BR fputws (3),
2004-11-03 13:51:07 +00:00
.BR fseek (3),
.BR fwrite (3),
.BR gets (3),
.BR putwchar (3),
2004-11-03 13:51:07 +00:00
.BR scanf (3),
.BR unlocked_stdio (3)