fputc 中文man頁面
NAME
fputc, fputs, putc, putchar, puts - 輸出字符和字符串
總覽 (SYNOPSIS)
#include <stdio.h> 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() 把 字符 c 轉(zhuǎn)換到 unsigned char 類型, 然后 從 stream 流 輸出.
fputs() 把 字符串 s 從 stream 流 輸出, 但是 不輸出 結(jié)尾處的 '\0'.
putc() 等于 fputc() , 只是 它 可能 以 宏 的 形式 實(shí)現(xiàn), 并 多次 訪問 stream 流.
putchar(c); 等于 putc(c,stdout).
puts() 從 stdout 輸出 字符串 s 和 一個(gè) 換行符 (newline).
這里 描述的 函數(shù) 可以 混合 使用, 也可以 結(jié)合 stdio 庫中 其他的 輸出函數(shù) 處理 同一個(gè) 輸出流.
相應(yīng)的 無鎖函數(shù)(non-locking) 參見 unlocked_stdio(3).
返回值 (RETURN VALUE)
如果 操作 成功, fputc(), putc() 和 putchar() 返回 把 字符 從 unsigned char 類型 轉(zhuǎn)換來的 int 值, 否則 返回 EOF .
如果 操作 成功, puts() 和 fputs() 返回 大于等于零的值, 否則 返回 EOF .
參考標(biāo)準(zhǔn) (CONFORMING TO)
ANSI - C, POSIX.1
BUGS
建議 不要 混合 stdio 庫的 輸出函數(shù) 和 低層 write() 函數(shù) 對(duì) 輸出流 對(duì)應(yīng) 文件描述符 的 調(diào)用; 其 結(jié)果 沒有 定義, 極可能不是 你 需要的.
另見 (SEE ALSO)
write(2), ferror(3), fopen(3), fseek(3), fwrite(3), gets(3), scanf(3), unlocked_stdio(3)
#p#
NAME
fputc, fputs, putc, putchar, puts - output of characters and strings
SYNOPSIS
#include <stdio.h> 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
ANSI - C, POSIX.1
BUGS
It is not advisable to mix calls to output functions from the stdio library with low - level calls to write() for the file descriptor associated 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), fseek(3), fwrite(3), gets(3), scanf(3), unlocked_stdio(3)