Get Value from line

In this part from my code i could read the value of time
{
if (linenumber==10) {
getline(inputfile,line,’-’);
inputfile>>time;}
}

this is the line 10:
TOTAL_TIME - 2488.764000

But in different data files this line appear as follows:
total time 19856

i am trying to modify this code part to get the results but it dose not give the expected result.
Can you plz Check

Hi,

this does not seem to be ROOT-related. But anyway, we should be able to reproduce the problem, so please let us know how the following variables are defined and used:
linenumber, inputfile, line, time

here is my whole code,
the problem in line 37,

this code can read the data line when it is in the formate:
TOTAL_TIME - 2488.764000

try this

 if (linenumber==10{
         getline(inputfile,live, ' ');
          getline(inputfile,time, ' ');
          line.append(1, ' ');
          line+=time;
          inputfile>>time;
        }
1 Like

not working, can you try again please

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.