- 850 名前:デフォルトの名無しさん mailto:sage [2009/06/10(水) 01:29:17 ]
- たとえば古いgccはstringsteamの中身に挙動不審なバグがあるので、それが原因かもしれない。
今やってみたらとりあえずgcc 4.1とVC2008はどっちもちゃんと動いた。 #include <iostream> #include <sstream> using namespace std; int main(void) { int t[3]; char w; stringstream ss("1,2,3,,"); ss >> t[0] >> w >> t[1] >> w >> t[2] >> w >> w; cout << t[0] << " " << t[1] << " " << t[2] << endl; return 0; } 出力 1 2 3
|

|