#include
#include
#include
#include
using namespace std;
void csvline_populate(vector &record, const string& line, char delimiter);
int main(int argc, char *argv[])
{
vector row;
string line;
ifstream in("input.csv");
if (in.fail()) { cout << "File not found" <
while(getline(in, line) && in.good() )
{
csvline_populate(row, line, ',');
for(int i=0, leng=row.size(); i
cout << row[i] << "\t";
cout << endl;
}
in.close();
return 0;
}
void csvline_populate(vector &record, const string& line, char delimiter)
{
int linepos=0;
int inquotes=false;
char c;
int i;
int linemax=line.length();
string curstring;
record.clear();
while(line[linepos]!=0 && linepos < linemax)
{
c = line[linepos];
if (!inquotes && curstring.length()==0 && c=='"')
{
//beginquotechar
inquotes=true;
}