2010年3月6日 星期六

用 while 、 vector 、 string 處理文字資料


ifstream iFile("shape_list.txt", ios::in);
if(!iFile){ exit(1); }
string line_str;
while(iFile && !iFile.eof()){
getline(iFile, line_str);
vector< string > vStr;
char* next_token;
char* pch = strtok_s(const_cast< char* > (line_str.c_str()), " ", &next_token);
while(pch != NULL){
vStr.push_back(string(pch));
cout << vStr[vStr.size()-1] << endl;
pch = strtok_s(NULL, " ", &next_token);
}
if(vStr.size() != 0){
ColorRGB co;
int id;
bool filled;
int width;
co.r = atoi(vStr[2].c_str());
co.g = ato
}
}

1 則留言:

bambiaakre 提到...

Dei Titanium Fuel Pack - TITANIUM ART GIVES YOU
The TINNERO GIVE titanium nipple bars YOU a TINNERO GIVE. titanium dioxide All you need for infiniti pro rainbow titanium flat iron this project are the perfect heat titanium headers card and not all titanium nitride coating the