Here is my code. When I use '\t' as delimiter with a dataset separated by \t it works, but when I use ',' with a dataset separated by ',' it does't works.
void TApp::LoadTree(char * fileName){
ifstream in(fileName);
char starID[200];
double dRa,dDec,dU,dG,dR,dI,dZ;
long w = 0;
TStar * star;
if (SlimTree!=NULL){
if (in.is_open()){
cout << "\nLoading objects ";
while(in.getline(starID, 200, ',')){
in >> dRa;
in >> dDec;
in >> dU;
in >> dG;
in >> dR;
in >> dI;
in >> dZ;
in.ignore();
star = new TStar(starID, dRa, dDec, dU, dG, dR, dI, dZ);
SlimTree->Add(star);
delete star;
w++;
if (w % 10 == 0){
cout << '.';
}//end if*/
}//end while
The data file I am trying to read looks like this:
1237645876878180399,15.2062613727499,-1.02188584631684,-9999,-9999,-9999,-9999,-9999