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
examples
manual
istrstream.cpp
Go to the documentation of this file.
1
29
#include <iostream>
// for cout
30
#include <strstream>
// for strstream
31
32
#include <
examples.h
>
33
34
35
int
main
()
36
{
37
// create two constant istrstream objects and initialize their
38
// underlying strstreambufs with string literals; the objects
39
// do not create copies of the literals but use them directly
40
// for efficiency
41
std::istrstream
a
(
"Ce n'est pas l'homme qui prend la mer, "
);
42
std::istrstream
b
(
"c'est la mer qui prend l'homme."
);
43
44
// create a dynamic strstream object
45
std::strstream
out
;
46
47
// output the contents of the streams into out
48
out
<<
a
.rdbuf () <<
b
.str () <<
'\n'
;
49
50
// output the contents of out to standard output
51
std::cout <<
out
.rdbuf () <<
'\n'
;
52
53
// output the contents of the stream objects to standard output
54
std::cout <<
a
.str () <<
'\n'
<<
b
.rdbuf () <<
'\n'
;
55
56
// the dtors of a and b will not release any storage
57
// since the objects did not allocate any
58
59
// the dtor of out will release allocated storage since
60
// neither freeze() nor str() was called on the object
61
62
return
0;
63
}
a
#define a
Definition
17.names.cpp:109
b
#define b
Definition
17.names.cpp:110
out
const int out
Definition
27.stringbuf.virtuals.cpp:443
examples.h
main
int main()
Definition
istrstream.cpp:35
Generated by
1.9.8