-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringstreams.cpp
More file actions
57 lines (42 loc) · 1.13 KB
/
Stringstreams.cpp
File metadata and controls
57 lines (42 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(){
string firstname = "Donald \n";
ostringstream outSS;
if(outSS.str() == "")
cout << "not outSS1 \n"; //This
else
cout << "OUTSS1 \n";
outSS << firstname; //after insertion
if(outSS.str() == "")
cout << "not outSS2 \n"<< endl;
else
cout << "OUTSS2 \n"<< endl; //THIS
cout << outSS.str();
outSS.flush();
outSS.clear();
cout << outSS.str();
outSS << "hello bob3";
cout << outSS.str()<< endl;
outSS << "4hello\0 bob5";
cout << outSS.str() << endl;
outSS.flush();
outSS.clear();
outSS << "6hello\0 bob7" << endl;
cout << outSS.str();
string s1;
cin >> s1;
cout << s1;
/*
_______ __________
| \ / \
____________| BUFFER \_______/ Running |
_O_L_L_E_H__ ________ Program |
\________/ \_________/
*/
//As you type a buffer is being filled.
//When you press enter it sends from buffer to program running
//NOTHING Is sent until you hit ENTER, it takes buffer and sends to Program
}