Write a character to a stream (fputc) or to stdout (_fputchar).
#include <stdio.h>
int fputc( intc,FILE *stream );
int _fputchar( int c );
c | Character to be written | |
stream | Pointer to FILE structure |
The fputc function writes the single character c to the output stream at the current position. The _fputchar function is equivalent to fputc(c, stdout).
The fputc and _fputchar routines are similar to putc and putchar, but are functions rather than macros.
The fputc and _fputchar functions return the character written. A return value of EOF indicates an error.
fputc
Standards:ANSI, UNIX
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X
_fputchar
Standards:None
16-Bit:DOS, QWIN
32-Bit:DOS32X
fgetc, _fgetchar, putc, putchar
/* FPUTC.C: This program uses fputc and _fputchar to send a character
* array to stdout.
*/
#include <stdio.h>
void main( void )
{
char strptr1[] = “This is a test of fputc!!\n”;
char strptr2[] = “This is a test of _fputchar!!\n”;
char *p;
/* Print line to stream using fputc. */
p = strptr1;
while( (*p != '\0') && fputc( *(p++), stdout ) != EOF )
;
/* Print line to stream using _fputchar. */
p = strptr2;
while( (*p != '\0') && _fputchar( *(p++) ) != EOF )
;
}
This is a test of fputc!!
This is a test of _fputchar!!