|
|
1.1 root 1: #include "stream.h"
2:
3: /*
4: Allocate some space for the buffer.
5: Returns: EOF on error
6: 0 on success
7: */
8: int streambuf.doallocate()
9: {
10: if ((base = new char[BUFSIZE]) != NULL) {
11: pptr = gptr = base;
12: eptr = base + BUFSIZE;
13: alloc = 1;
14: return 0;
15: } else
16: return EOF;
17: }
18:
19: /*
20: Come here on a put to a full buffer. Allocate the buffer if
21: it is uninitialized.
22: Returns: EOF on error
23: the argument on success
24: */
25: virtual int streambuf.overflow(int c)
26: {
27: if (allocate() == EOF) return EOF;
28: if (c != EOF) *pptr++ = c;
29: return c&0377;
30: }
31:
32: /*
33: Fill a buffer.
34: Returns: EOF on error or end of input
35: next character on success
36: */
37: virtual int streambuf.underflow()
38: {
39: return EOF;
40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.