The following functions allow code to scan the contents of the input buffer
of a FILE *
stream, without first copying it into a separate memory
area via fread
.
The function freadahead
returns
the number of bytes waiting in the input buffer of the given stream.
This includes both
the bytes that have been read from the underlying input source
and the bytes that have been pushed back through ungetc
.
A function call freadptr (stream, &size)
returns
a pointer to the input buffer of the given stream
, or NULL.
If the returned pointer is non-NULL,
size
is set to the (positive) size of the input buffer.
If the returned pointer is NULL, you should use
getc (stream)
,
fgetc (stream)
,
or fread (..., stream)
to access the input from stream
.
A function call freadseek (stream, offset)
is the same as fseek (stream, offset, SEEK_CUR)
,
except that the latter does not work
on non-seekable input streams (such as pipes).