ffputc(3)

LIBRARY
#include <xtend/fast-file.h>
-lxtend

SYNOPSIS

int     ffputc(int ch, ffile_t *stream)

ARGUMENTS
ch      Character to write to stream
stream  Pointer to an ffile_t object opened by ffopen(3)

DESCRIPTION
ffputc() and the macro equivalent FFPUTC() write a single character to a ffile_t stream opened by ffopen(3). The ffile_t system is simpler than and several times as fast as FILE on typical systems. It is intended for processing large files character-by-character, where low-level block I/O is not convenient, but FILE I/O causes a bottleneck.

RETURN VALUES
The character written, or EOF if unable to write

EXAMPLES
char    *infilename, *outfilename;
ffile_t *instream, *outstream;
int     ch;
if ( (instream = ffopen(infilename, O_RDONLY)) == NULL )
{
    fprintf(stderr, "Cannot open %s for reading.n", infilename);
    exit(EX_NOINPUT);
}
if ( (outstream = ffopen(outfilename, O_WRONLY|O_CREAT|O_TRUNC)) == NULL )
{
    fprintf(stderr, "Cannot open %s for writing.n", outfilename);
    exit(EX_NOINPUT);
}
while ( (ch = FFGETC(stream)) != EOF )
    FFPUTC(ch, outstream);
ffclose(instream);
ffclose(outstream);

SEE ALSO
ffopen(3), ffgetc(3), ffclose(3)