Re: [問題] C++ string 與 C char* 使用strtok的問題
看板C_and_CPP (C/C++)作者adxis (Acquire higher)時間16年前 (2010/03/02 21:51)推噓1(1推 0噓 6→)留言7則, 3人參與討論串2/3 (看更多)
※ 引述《Aligu1009 (=.=)》之銘言:
#include <sstream>
#include <string>
#include <iostream>
int main()
{
// stringstream 的用途?
std::istringstream sin("this is xxx");
std::string word;
// 為甚麼 sin>>word 可以轉 boolean ?
while(sin>>word){
std::cout<<word<<"\n";
}
return 0;
}
請小心服用
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.218.30
※ 編輯: adxis 來自: 140.123.218.30 (03/02 21:53)
推
03/02 21:54, , 1F
03/02 21:54, 1F
→
03/02 22:01, , 2F
03/02 22:01, 2F
→
03/02 22:03, , 3F
03/02 22:03, 3F
→
03/02 22:04, , 4F
03/02 22:04, 4F
→
03/02 22:09, , 5F
03/02 22:09, 5F
→
03/02 22:10, , 6F
03/02 22:10, 6F
→
03/02 22:11, , 7F
03/02 22:11, 7F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 3 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章