So I was trying to read a csv file using c++ and do some calculation and output to another csv file. Everything works fine but when the program reads a line :
<a href="http://www.google.com" target="_blank">google</a>
and I want to see what the program has read so I cout that string, and it shows:
<a href=""http://www.google.com"" target=""_blank"">google</a>
Basically it doubles every double quotation marks? How can I solve this?
Edits:
Here's my code:
int main()
{
ifstream read;
ofstream write;
string line;
string cell;
int col = 0;
string temp;
string links;
read.open("Book1.csv");
write.open("output.csv");
if (read.is_open())
{
cout << "opened" <<endl ;
getline(read, line);
while(getline(read,temp))
{
stringstream line(temp);
while (getline(line, cell, ','))
{
if (col > 9)
{
links.pop_back();
write << links<<endl;
col = 0;
links = "";
break;
}
else
{
if (cell != "")
{
if (col == 0)
{
write << cell<<',';
}
else if (col == 1)
{
write << cell<<',';
}
else
{
cell.erase(0, 1);
cell.pop_back();
links += cell;
links += '/';
}
cout << cell << endl;
}
col += 1;
}
}
}
}
else
{
cout << "failed" << endl;
}
read.close();
write.close();
}