Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_ff_ungetc(3) 	    Library Functions Manual		 xt_ff_ungetc(3)

NAME
     xt_ff_ungetc() - Put a character back into a fast file stream read buffer

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

SYNOPSIS
     int     xt_ff_ungetc(xt_ff_t *stream, int ch)

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

DESCRIPTION
     xt_ff_ungetc(3) returns a single character read by xt_ff_getc(3) to the in-
     put  buffer  of  a stream opened by xt_ff_open(3).  All characters from the
     most recently read block plus a maximum of XT_FAST_FILE_UNGETC_MAX  charac-
     ters from the previously read block may be returned.

     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;
     xt_ff_t *instream;
     int     ch;

     if ( (instream = xt_ff_open(infilename, O_RDONLY)) == NULL )
     {
	 fprintf(stderr, "Cannot open %s for reading: %s.n",
		 infilename, strerror(errno));
	 exit(EX_NOINPUT);
     }
     if ( (ch = xt_ff_getc(instream)) != MY_FAVORITE_CHAR )
	 xt_ff_ungetc(ch, instream);
     xt_ff_close(instream);

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

								 xt_ff_ungetc(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_ff_ungetc&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help