Автор:
cramur
Описание: boost::tokenizer usage
Язык: C++
/*
* === FUNCTION =====================================================
* Name: fillPointSetFromFile
* Description: fills points from file
* ====================================================================
*/
void fillPoinSetFromFile(char* filename)
{
std::ifstream fInput(filename);
std::string tmpData;
point tmpPoint;
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep(";\t ");
while(fInput.eof() == false)
{
std::getline(fInput,tmpData);
if(tmpData.empty())
break;
tokenizer tok(tmpData, sep);
tokenizer::iterator t = tok.begin();
tmpPoint.x = boost::lexical_cast<fract>(*t);
t++;
tmpPoint.y = boost::lexical_cast<fract>(*t);
points.push_back(tmpPoint);
}
fInput.close();
}
|
Последние размещения:
antonivanov (SQL)
antonivanov (PHP)
brinza (PHP)
ilyhamas (Delphi)
Riateche (PHP)
otherlight (Java)
otherlight (JavaScript)
otherlight (CSS)
otherlight (CSS)
biophreak (JavaScript)
n4n (Perl)
prostoHz (Java)
ndubinkin (XML)
Riateche (Plain Text)
Slapotam (Perl)
ksurent (Perl)
John_Wein (Java)
John_Wein (HTML)
Riateche (HTML)
|