Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi folks,

I have to know that which the better concept of reading TSV file is?

Using ODO JET 4.0 connection sting in SQL Server and reading files from that

Or Using C# code to reading TSV files.

Please suggest me that which is faster better and most reliable (error prediction).

Thanks in advance.
Posted

Thanks, GanesanSenthilvel

But i have the code, i just need to know the which is faster better and most reliable.

Please help me in that case.
 
Share this answer
 
C++
#include <fstream>
#include <string>
#include <vector>
using namespace std;

void ReadTSV(const char* filename)
{
using namespace std;

ifstream infile(filename);
if (!infile) {
cout << "unable to load file" << endl;
}
string str;

vector<vector<string> > vvStr;
vector<string> vStr;
int pos1, pos2;
while (getline(infile, str))
{
pos1 = 0;
while((pos2 = str.find('\t'))!= string::npos)
{
vStr.push_back(str.substr(pos1, pos2));
pos1 = pos2++;
}
vStr.push_back(str.substr(pos1, string::npos));
vvStr.push_back(vStr);
}

}
 
Share this answer
 
Comments
angle57 10-Oct-11 2:10am    
Thanks, GanesanSenthilvel
But i have the code, i just need to know the which is faster better and most reliable.

Please help me in that case.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900