-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_stringstream.cpp
More file actions
48 lines (41 loc) · 889 Bytes
/
test_stringstream.cpp
File metadata and controls
48 lines (41 loc) · 889 Bytes
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
/*
* =====================================================================================
*
* Filename: test_stringstream.cpp
*
* Description: yanglujun
*
* Version: 1.0
* Created: 08/11/2011 03:33:51 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
#include <iostream>
#include <sstream>
int main()
{
std::ostringstream _ostream;
std::istringstream _istream;
std::stringstream _sstream;
int i=10;
float f=11.2;
std::string ss;
_sstream<<i<<" "<<f;
_sstream<<"hello \n"<<12;
_sstream>>i;
_sstream>>ss;
std::cout<<_sstream.str()<<std::endl;
char *c_p=0;
char *cc_p=0;
c_p++;
printf("c_p++ ; =%d\n",c_p);
c_p=0;
c_p=9+c_p;
printf("c_p+2 ; =%d\n",c_p);
return 0;
}