Name
fputc function — Writes a character
Synopsis
int fputc(int c, FILE* stream)
The fputc
function writes a
single character to stream
. The
character must be an unsigned
char
, which is automatically
promoted to int
, so the proper
way to print a variable of type char
is as follows:
char ch; fputc(static_cast<unsigned char>(ch), stream);
The return value is EOF
for
an error or c
for success.
See Also
putc macro, fwputc
in <cwchar>
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.