putsのヘルプ・マニュアル
日本語 英語
puts --help
man puts
PUTS(3) Linux Programmer’s Manual PUTS(3)
名前
fputc, fputs, putc, putchar, puts - 文字と文字列の出力
書式
#include
int fputc(int c, FILE *stream);
int fputs(const char *s, FILE *stream);
int putc(int c, FILE *stream);
int putchar(int c);
int puts(const char *s);
説明
fputc() は、キャラクタ c を unsigned char にキャストし、 stream に書き
込む。
fputs() は、文字列 s を stream に書き込む。文字列に続く '\0' は出力しな
い。
putc() は、 stream を一度以上評価するマクロとして実装されているかも知れ
ないという点を除き、 fputc() と同じである。
putchar(c); は、 putc(c,stdout) と同じである。
puts() は、文字列 s と改行を stdout に書き込む。
ここで説明された関数はお互いに混在して使用することができ、また、 stdio
ラ イブラリに含まれる他の出力関数を同じ出力ストリームに対して呼び出す事
が出来る。
これらの処理をロックせずに行いたいときは、 unlocked_stdio(3) を参照のこ
と。
返り値
fputc(), putc(), putchar() は unsigned char として書き込まれた文字を
int にキャストして返す。エラーが発生した場合は EOF を返す。
puts() と fputs() は、成功すると負ではない数を、エラーが発生した場合 は
EOF を返す。
準拠
C89, C99.
バグ
stdio ライブラリに含まれる出力関数と、同じ出力ストリームに結びつけられ
たファイルディスクリプタに対する write(2) の低レベル呼び出しを混在し て
使 用することは賢明ではない。その結果は定義されておらず、望む結果が得ら
れない可能性が高い。
関連項目
write(2), ferror(3), fopen(3), fputwc(3), fputws(3), fseek(3),
fwrite(3), gets(3), putwchar(3), scanf(3), unlocked_stdio(3)
GNU 1993-04-04 PUTS(3)
PUTS(3) Linux Programmer’s Manual PUTS(3)
NAME
fputc, fputs, putc, putchar, puts - output of characters and strings
SYNOPSIS
#include
int fputc(int c, FILE *stream);
int fputs(const char *s, FILE *stream);
int putc(int c, FILE *stream);
int putchar(int c);
int puts(const char *s);
DESCRIPTION
fputc() writes the character c, cast to an unsigned char, to stream.
fputs() writes the string s to stream, without its trailing '\0'.
putc() is equivalent to fputc() except that it may be implemented as a
macro which evaluates stream more than once.
putchar(c); is equivalent to putc(c,stdout).
puts() writes the string s and a trailing newline to stdout.
Calls to the functions described here can be mixed with each other and
with calls to other output functions from the stdio library for the
same output stream.
For non-locking counterparts, see unlocked_stdio(3).
RETURN VALUE
fputc(), putc() and putchar() return the character written as an
unsigned char cast to an int or EOF on error.
puts() and fputs() return a non-negative number on success, or EOF on
error.
CONFORMING TO
C89, C99.
BUGS
It is not advisable to mix calls to output functions from the stdio
library with low-level calls to write(2) for the file descriptor asso-
ciated with the same output stream; the results will be undefined and
very probably not what you want.
SEE ALSO
write(2), ferror(3), fopen(3), fputwc(3), fputws(3), fseek(3),
fwrite(3), gets(3), putwchar(3), scanf(3), unlocked_stdio(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 1993-04-04 PUTS(3)