xt_ff_putc(3)

NAME
xt_ff_putc() - Write a character to a fast file stream

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

SYNOPSIS
inline int     xt_ff_putc(xt_ff_t *stream, int ch)

ARGUMENTS
ch      Character to write to stream
stream  Pointer to an xt_ff_t object opened by xt_ff_open(3)

DESCRIPTION
xt_ff_putc(3) writes a single character to a xt_ff_t stream opened by xt_ff_open(3). The xt_ff_t system is simpler than and much faster than traditional 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;
xt_ff_t *instream, *outstream;
int     ch;
if ( (instream = xt_ff_open(infilename, O_RDONLY)) == NULL )
{
    fprintf(stderr, "Cannot open %s for reading.n", infilename);
    exit(EX_NOINPUT);
}
if ( (outstream = xt_ff_open(outfilename, O_WRONLY|O_CREAT|O_TRUNC)) == NULL )
{
    fprintf(stderr, "Cannot open %s for writing.n", outfilename);
    exit(EX_NOINPUT);
}
while ( (ch = xt_ff_getc(stream)) != EOF )
    xt_ff_puts(ch, outstream);
xt_ff_close(instream);
xt_ff_close(outstream);

SEE ALSO
xt_ff_open(3), xt_ff_getc(3), xt_ff_close(3)