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
21.string.io.stdcxx-206.cpp
Go to the documentation of this file.
1
29
#include <strstream>
30
#include <string>
31
#include <cassert>
32
33
void
test
(
const
std::string&
str
,
const
std::streamsize width)
34
{
35
enum
{ bufsize = 10 };
36
char
buf
[bufsize];
37
std::ostrstream
os
(
buf
, bufsize);
38
39
os
.width (width);
40
os
.exceptions (std::ios_base::failbit | std::ios_base::badbit);
41
42
try
{
43
os
<<
str
;
44
}
45
catch
(std::ios_base::failure&) {
46
}
47
48
#ifndef _RWSTD_NO_EXT_KEEP_WIDTH_ON_FAILURE
49
assert
(width ==
os
.width ());
50
#else
51
assert
(0 ==
os
.width ());
52
#endif
53
}
54
55
int
main
()
56
{
57
std::string
str
(
"abcdefghijk"
);
58
59
test
(
str
, 2);
60
test
(
str
,
str
.size () + 2);
61
62
return
0;
63
}
os
#define os
Definition
17.names.cpp:511
buf
#define buf
Definition
17.names.cpp:452
main
int main()
Definition
21.string.io.stdcxx-206.cpp:55
test
void test()
Definition
23.vector.modifiers.stdcxx-495.cpp:48
assert
#define assert(expr)
Definition
_cassert.h:40
str
const char * str
Definition
exec.cpp:170
Generated by
1.9.8