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.istream.get.stdcxx-60.cpp
Go to the documentation of this file.
1
29
#include <cassert>
30
#include <sstream>
31
32
int
main
()
33
{
34
// According to LWG issue 243
35
// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#243:
36
//
37
// "...if the sentry constructor [of an unformatted input function]
38
// exits by throwing an exception or if the sentry object returns
39
// false, when converted to a value of type bool, the function
40
// returns without attempting to obtain any input. In either case
41
// [...] unformatted input functions taking a character array of
42
// non-zero size as an argument shall also store a null character
43
// (using charT()) in the first location of the array."
44
45
std::istringstream
strm
;
46
47
strm
.setstate (
strm
.failbit);
48
49
char
s
[3] = {
'x'
,
'y'
,
'z'
};
50
strm
.get (
s
, 2);
51
52
assert
(
'\0'
==
s
[0]);
53
assert
(
'y'
==
s
[1]);
54
assert
(
'z'
==
s
[2]);
55
56
return
0;
57
}
s
#define s
Definition
rw_alg_test.h:221
strm
#define strm
Definition
17.names.cpp:549
main
int main()
Definition
27.istream.get.stdcxx-60.cpp:32
assert
#define assert(expr)
Definition
_cassert.h:40
Generated by
1.9.8