1.Parse csv file with boost tokenizer in C++
参考网址:http://mybyteofcode.blogspot.com/2010/02/parse-csv-file-with-boost-tokenizer-in.html 请自动翻
include <iostream> // cout, endl
#include <fstream> // fstream
#include <vector>
#include <string>
#include <algorithm> // copy
#include <iterator> // ostream_operator
#include <boost/tokenizer.hpp>
int main()
{
using namespace std;
using namespace boost;
string data("data.csv");
ifstream in(data.c_str());
if (!in.is_open()) return 1;
typedef tokenizer< escaped_list_separator<char> > Tokenizer;
vector< string > vec;
string line;
while (getline(in,line))
{
Tokenizer tok(line);
vec.assign(tok.begin(),tok.end());
if (vec.size() < 3) continue;
copy(vec.begin(), vec.end(),
ostream_iterator<string>(