fileRead.open(file.c_str());
string line;
int indice = 0;
string str;
double d;
while(fileRead)
{
indice++;
vector< double > desc;
fileRead > > str;
if(str.length() < 2 )
{
break;
cout<<"break";
}
//read from descriptor file
const char * c = str.c_str();
const char * pch = c;
const char * pchAux = c;
while (pch!=NULL)
{
pch=strchr(pchAux,',');
if(pch == NULL) break;
char cDouble[pch-pchAux+1];
strncpy (cDouble, pchAux ,pch-pchAux);
cDouble[pch-pchAux]='\0';
d = strtod(cDouble, NULL);
desc.push_back(d);
pchAux = pch+1;
}
}
fileRead.close();
No comments:
Post a Comment