T
TyPR124
I have a file that I open and take all the lines in it and store it in
file[x] where x is the line number. There should be a line that starts
with <title> and ends with </title> and can have anything in between.
for (int a=chan.start; a<=item[1].start; a++) {
if (checkLine(file[a], "<title>")) {
for (int b=7; b<=file[a].length(); b++) {
if ( (file[a].substr(b)=="</title>") || (file[a].substr(b,
file[a].length()-1), "</title>") ) {
chan.title=file[a].substr(7, b-1);
break;
}
else if (b==file[a].length()) {
cout << endl << "What is the Channel Title?" << endl;
getline(cin, chan.title);
file[a] = "<title>" + chan.title + "</title>";
break;
}
}
break;
}
else if (a==item[1].start) {
cout << "What is the Channel Title?" << endl;
getline(cin, chan.title);
insertLine(a, "<title>" + chan.title + "</title>");
break;
}
The problem is that it either deletes or adds to what chan.title
should be. Like if chan.title should be "eltit" it might say that its
"eltit</ti" or something like that. And it deletes/adds randomly
depending on the length of the title... so what is wrong with it?
Thanks.
file[x] where x is the line number. There should be a line that starts
with <title> and ends with </title> and can have anything in between.
for (int a=chan.start; a<=item[1].start; a++) {
if (checkLine(file[a], "<title>")) {
for (int b=7; b<=file[a].length(); b++) {
if ( (file[a].substr(b)=="</title>") || (file[a].substr(b,
file[a].length()-1), "</title>") ) {
chan.title=file[a].substr(7, b-1);
break;
}
else if (b==file[a].length()) {
cout << endl << "What is the Channel Title?" << endl;
getline(cin, chan.title);
file[a] = "<title>" + chan.title + "</title>";
break;
}
}
break;
}
else if (a==item[1].start) {
cout << "What is the Channel Title?" << endl;
getline(cin, chan.title);
insertLine(a, "<title>" + chan.title + "</title>");
break;
}
The problem is that it either deletes or adds to what chan.title
should be. Like if chan.title should be "eltit" it might say that its
"eltit</ti" or something like that. And it deletes/adds randomly
depending on the length of the title... so what is wrong with it?
Thanks.