My code for line[34] how to make it grab the data

I'm grabbing data from an html file and I need only the 34th character or above to 4 spaces only on certain lines that have the html that have *racelinesb" but my if statement statement is printing out a character after it finds racelineb ,that is not the right character.it should only print "r" but it prints other characters and position is printing out a long number instead of real position numbers. Hees my code and output. Im writing this totally on a compiler on an android phone so cant use stuff thst would be available on a regular computet. It all has to be avaible in mobile c++ on google play. Thats my compiler for this project.

using namespace std;


int main ()
{
ifstream infile;
infile.open("page.out");

string line;
string sub;
string number;
int count =1;
bool found = 1;

while
( infile.good())
{
count++;
getline(infile, line);
cout<<"start contents" <<line<<"end contents" <<count<<endl;

std::size_t pos = line. find("racelineb");

cout<<"position"<<
pos<<endl;

if(line.find("racelineb ")){cout<<"*****"<<line
[16];sub = line[16]
;if(sub== "r"){
number = line[3
4];
cout<<" line 34"<<
number;}}

}
infile.close();

return 0;
}

Heres some output of thid code
es" nowrap>TM&nbsp;</td>end contents1645
position4294967295
*****estart contents <td class= "racelines" nowrap>550&nbsp;</td>end contents1646
position4294967295
*****r line 345start contents <td class= "raceline">F&nbsp;</td>end contents1647
position4294967295
*****r line 34/start contents <td class= "raceline">31.58&nbsp;</td>end contents1648
position4294967295


Last edited on
Topic archived. No new replies allowed.