_fputchar() — Write Character
Format
#include <stdio.h>
int _fputchar(int c);
Language Level
Extension
Threadsafe
Yes
Description
_fputchar
writes
the single character c to the stdout stream at the current position.
It is equivalent to the following fputc call: fputc(c, stdout);
For
portability, use the ANSI/ISO fputc function instead of _fputchar.Return Value
_fputchar
returns
the character written. A return value of EOF
indicates
that a write error has occurred. Use ferror
and feof
to
tell whether this is an error condition or the end of the file.
For information about errno values for _fputchar
,
see fputc() — Write Character.
Example
This example writes the contents
of buffer to stdout:
#include <stdio.h>
int main(void)
{
char buffer[80];
int i,ch = 1;
for (i = 0; i < 80; i++)
buffer[i] = 'c';
for (i = 0; (i < 80) && (ch != EOF); i++)
ch = _fputchar(buffer[i]);
printf("\n");
return 0;
}
The output should be similar to: ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc