#include <stdio.h>
int putc(int c, FILE *stream);
int putc_unlocked(int c, FILE *stream);
int putchar(int c);
int putchar_unlocked(int c);
int fputc(int c, FILE *stream);
int putw(int w, FILE *stream);
See the NOTES section of this page.
putc_unlocked() and putchar_unlocked() are respectively variants of putc() and putchar() that do not lock the stream. It is the caller’s responsibility to acquire the stream lock before calling these functions and releasing the lock afterwards; see flockfile(3S) and stdio(3S) .
fputc() behaves like putc(), but is a function rather than a macro. fputc() runs more slowly than putc(), but it takes less space per invocation and its name can be passed as an argument to a function.
putw() writes the C int (word) w to the standard I/O output stream (at the position of the file pointer, if defined). The size of a word is the size of an integer and varies from machine to machine. putw() neither assumes nor causes special alignment in the file.
Failure will occur, for example, if the file stream is not open for writing or if the output file cannot grow.
Because of possible differences in word length and byte ordering, files written using putw() are machine-dependent, and may not be read using getw() on a different processor.
Functions exist for all the above defined macros. To get the function form, the macro name must be undefined (for example, #undef putc).
fputc(), putc(), putchar(), and putw() are MT-Safe in multi-thread applications. putc_unlocked() and putchar_unlocked() are unsafe in multi-thread applications.