I don't know much C++. I did mostly java but I'm trying to write a program in C++. The idea is simple, it looks at a text file and makes a new textfile from some data in the original. That part works fine. Now I need to break up each line of this new textfile into individual parts. In java I'd use substring to do this but in C++ it doesn't quite work the way I want. I'm trying to print a name on the line. The name always starts 6 characters in, and is terminated by the first occurence of "</td>". It doesn't do what I want it and prints random amounts of characters. Here's what I have:
Code:
ifstream myread2("goto.txt");
ofstream myorder("order.txt");
while(myread2.is_open() && line.compare("-")!=0)
{
getline (myread2,line);
string name;
string pos;
double points;
int e =line.find_first_of("</td>",5);
name = line.substr(6,e);
cout << name << endl;
}
myread2.close();