C++ stringstream

1 개요[ | ]

C++ stringstream
#include <iostream>
#include <sstream>
using namespace std;

int main () {
    stringstream ss;
    ss << 100 << ' ' << 200;
    int foo,bar;
    ss >> foo >> bar;
    cout << foo << endl; // 100
    cout << bar << endl; // 200
}
#include <iostream>
#include <sstream>
using namespace std;

int main() {
    stringstream ss("hello world");
    string temp;
    getline(ss, temp, ' ');
    cout << temp << endl; // hello
    getline(ss, temp, ' ');
    cout << temp << endl; // world
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}