open/4 option: eof_action(Action) QP_stream: unsigned char peof_act
This field is only used for an input stream. There are three states for
an input stream, normal, end of file, and past end of file.
An input stream is in normal state until it reaches end of file, where
the state is switched to end of file state. If there is no file border
code or the file border code is consumed, the input stream is switched
to past end of file state. The field peof_act
specifies which
action to take for reading from a stream at past end of file state.
The value of peof_act
can be one of the following.
QP_SEEK_ERROR
seek(error)
in open/4
.
An error for any type of seeking in the stream.
QP_PASTEOF_ERROR
eof_action(error)
in open/4
.
The errno
field of the stream is set to QP_E_EXHAUSTED
,
and the read call fails.
QP_PASTEOF_EOFCODE
eof_action(eof_code)
in open/4
.
Retuns the file border code for reading at the past end of file state.
The state of the input stream does not change. If there is no file
border code for the input stream, it is the same as setting the
field to QP_PASTEOF_ERROR
.
QP_PASTEOF_RESET
eof_action(reset)
in open/4
.
Resets the state of an input stream to normal state and calls
the bottom layer read function to get the
input record for reading at past end of file state.
Setting the field to this value may be useful for the stream with
QP_DELIM_TTY
format. It is possible to get more records
from a tty device after the end of file character is typed.
Once an input stream reaches end of file state, its bottom layer read function
will not be called unless the peof_act
field is
QP_PASTEOF_RESET
.