File: streams.html

package info (click to toggle)
modglue 1.17-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 656 kB
  • sloc: cpp: 4,011; sh: 193; makefile: 137
file content (27 lines) | stat: -rw-r--r-- 1,510 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

overflow:
    This function is called on output, when there is no buffer, or no
        space in the existing buffer.  If you want buffering, the buffer
        should be set up in the first call to overflow.  The argument is the
        character to be output, or EOF.  For historical reasons, it is
        probably advisable to call sync on EOF.

    The exact functionality of this function will depend on the
        buffering strategy used.  Without buffering, just output the
        argument, returning the character output, or EOF on error.  With
        buffering: if there is no buffer, create one, otherwise flush it,
        and insert the character into the buffer.  (Use the function setp to
        initialize the buffer, or to reset it to empty once you've flushed
        it, and the functions gptr and egptr to get the current values.)

underflow:
        This function is called on input, which is a little more
        complicated.  In particular, although the function returns the next
        character in the stream, it does *not* extract it from the stream.
        Input *must* be buffered, although a one character buffer is
        sufficient.  Also, there is no guarantee that the get buffer will be
        empty when this function is called, so you have to check that.  In
        all cases, when you return, 1) the next character must be present in
        the buffer -- if there wasn't a buffer before, you have to create
        one, and 2) that character must be returned.