ffungetc(3)

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

SYNOPSIS

int     ffungetc(int ch, ffile_t *stream)

ARGUMENTS
ch      Character to return to the input buffer
stream  Pointer to an ffile_t object opened by ffopen(3)

DESCRIPTION
ffungetc() returns a single character read by ffgetc(3) to the input buffer of a stream opened by ffopen(3). All characters from the most recently read block plus a maximum of XT_FAST_FILE_UNGETC_MAX characters from the previously read block may be returned. 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;
ffile_t *instream;
int     ch;
if ( (instream = ffopen(infilename, O_RDONLY)) == NULL )
{
    fprintf(stderr, "Cannot open %s for reading.n", infilename);
    exit(EX_NOINPUT);
}
if ( (ch = FFGETC(instream)) != MY_FAVORITE_CHAR )
    ungetc(ch, instream);
ffclose(instream);

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