Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
tests
regress
27.streambuf.sgetn.stdcxx-1026.cpp
Go to the documentation of this file.
1
29
#include <cassert>
30
#include <istream>
31
#include <streambuf>
32
33
int
main
()
34
{
35
static
int
x
=
'0'
;
36
37
struct
MyBuf
: std::streambuf {
38
// unbuffered, always successfully reads one character
39
int_type underflow () {
40
assert
(gptr () == egptr ());
41
return
x
++;
42
}
43
}
sb
;
44
45
// "endless" stream that never reaches EOF
46
std::istream endless (&
sb
);
47
48
char
s
[4] =
""
;
49
50
endless.read (
s
,
sizeof
s
);
51
52
// expect to find stream in good state (i.e., not EOF) and
53
// to have extracted as many characters as requested with
54
// just as many calls to underflow()
55
assert
(endless.good ());
56
assert
(
sizeof
s
== endless.gcount ());
57
assert
(
'0'
==
s
[0] &&
'1'
==
s
[1] &&
'2'
==
s
[2] &&
'3'
==
s
[3]);
58
}
sb
#define sb
Definition
17.names.cpp:542
x
#define x
Definition
17.names.cpp:140
s
#define s
Definition
rw_alg_test.h:221
main
int main()
Definition
27.streambuf.sgetn.stdcxx-1026.cpp:33
assert
#define assert(expr)
Definition
_cassert.h:40
MyBuf
Definition
27.ostream.unformatted.stdcxx-626.cpp:35
Generated by
1.9.8