المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Extracting a string from a tab-delimited file



C++ Programming
04-02-2009, 01:50 AM
I'm trying to create a small function for a program that should extract the data as a string from a column of a tab delimited text file. It seems to be returning an empty string though.

Let me know if you notice what's wrong with this function. Edit: this is VC++

Function:

string split_row(string line, int column)
{
// The first column would be column 1 for this function. Pass in the string
// we want to parse and the column we want parsed. Will return just the string
// from the column indicated for this row.

int c_temp;
string data;
int pos;
const string delimiter = "\t";

for(c_temp=1; c_temp