Simple Output by Characters or Lines
====================================
This section describes functions for performing character- and
line-oriented output.
These narrow streams functions are declared in the header file
`stdio.h' and the wide stream functions in `wchar.h'.
- Function: int fputc (int C, FILE *STREAM)
The `fputc' function converts the character C to type `unsigned
char', and writes it to the stream STREAM. `EOF' is returned if a
write error occurs; otherwise the character C is returned.
- Function: wint_t fputwc (wchar_t WC, FILE *STREAM)
The `fputwc' function writes the wide character WC to the stream
STREAM. `WEOF' is returned if a write error occurs; otherwise the
character WC is returned.
- Function: int fputc_unlocked (int C, FILE *STREAM)
The `fputc_unlocked' function is equivalent to the `fputc'
function except that it does not implicitly lock the stream.
- Function: wint_t fputwc_unlocked (wint_t WC, FILE *STREAM)
The `fputwc_unlocked' function is equivalent to the `fputwc'
function except that it does not implicitly lock the stream.
This function is a GNU extension.
- Function: int putc (int C, FILE *STREAM)
This is just like `fputc', except that most systems implement it as
a macro, making it faster. One consequence is that it may
evaluate the STREAM argument more than once, which is an exception
to the general rule for macros. `putc' is usually the best
function to use for writing a single character.
- Function: wint_t putwc (wchar_t WC, FILE *STREAM)
This is just like `fputwc', except that it can be implement as a
macro, making it faster. One consequence is that it may evaluate
the STREAM argument more than once, which is an exception to the
general rule for macros. `putwc' is usually the best function to
use for writing a single wide character.
- Function: int putc_unlocked (int C, FILE *STREAM)
The `putc_unlocked' function is equivalent to the `putc' function
except that it does not implicitly lock the stream.
- Function: wint_t putwc_unlocked (wchar_t WC, FILE *STREAM)
The `putwc_unlocked' function is equivalent to the `putwc'
function except that it does not implicitly lock the stream.
This function is a GNU extension.
- Function: int putchar (int C)
The `putchar' function is equivalent to `putc' with `stdout' as
the value of the STREAM argument.
- Function: wint_t putwchar (wchar_t WC)
The `putwchar' function is equivalent to `putwc' with `stdout' as
the value of the STREAM argument.
- Function: int putchar_unlocked (int C)
The `putchar_unlocked' function is equivalent to the `putchar'
function except that it does not implicitly lock the stream.
- Function: wint_t putwchar_unlocked (wchar_t WC)
The `putwchar_unlocked' function is equivalent to the `putwchar'
function except that it does not implicitly lock the stream.
This function is a GNU extension.
- Function: int fputs (const char *S, FILE *STREAM)
The function `fputs' writes the string S to the stream STREAM.
The terminating null character is not written. This function does
_not_ add a newline character, either. It outputs only the
characters in the string.
This function returns `EOF' if a write error occurs, and otherwise
a non-negative value.
For example:
fputs ("Are ", stdout);
fputs ("you ", stdout);
fputs ("hungry?\n", stdout);
outputs the text `Are you hungry?' followed by a newline.
- Function: int fputws (const wchar_t *WS, FILE *STREAM)
The function `fputws' writes the wide character string WS to the
stream STREAM. The terminating null character is not written.
This function does _not_ add a newline character, either. It
outputs only the characters in the string.
This function returns `WEOF' if a write error occurs, and otherwise
a non-negative value.
- Function: int fputs_unlocked (const char *S, FILE *STREAM)
The `fputs_unlocked' function is equivalent to the `fputs'
function except that it does not implicitly lock the stream.
This function is a GNU extension.
- Function: int fputws_unlocked (const wchar_t *WS, FILE *STREAM)
The `fputws_unlocked' function is equivalent to the `fputws'
function except that it does not implicitly lock the stream.
This function is a GNU extension.
- Function: int puts (const char *S)
The `puts' function writes the string S to the stream `stdout'
followed by a newline. The terminating null character of the
string is not written. (Note that `fputs' does _not_ write a
newline as this function does.)
`puts' is the most convenient function for printing simple
messages. For example:
puts ("This is a message.");
outputs the text `This is a message.' followed by a newline.
- Function: int putw (int W, FILE *STREAM)
This function writes the word W (that is, an `int') to STREAM. It
is provided for compatibility with SVID, but we recommend you use
`fwrite' instead (Note:Block Input/Output).