vector<string> trouble in pthread
I'm trying to compare strings from a vector with a global string, but
I can't get it right. When I print/display the vector is looks all
right, a small test file. But when I try to display the hits in the
threads I can't display the strings sitting the vector.
Code:
int i;
for (vector<string>::size_type i = myStart; i <= myEnd; i++) {
//Search forward
if(ref.find(searchVector.at(i)) != std::string::npos){
printf("FORWARD : My id: %d, myStart: %d, myEnd: %d, Sträng:
\n", tid, myStart, myEnd, searchVector.at(i).c_str() ); //prints no
string
myHits[i] = ref.find(searchVector.at(i));
} else if (ref.find(reverseString(searchVector.at(i))) !=
std::string::npos ){
printf("BACKWARD: My id: %d, myStart: %d, myEnd: %d, Sträng:
\n", tid, myStart, myEnd, searchVector.at(i).c_str() );
myHits[i] = ref.find(reverseString(searchVector.at(i)));
} else {
myHits[i] = 0;
printf("MISS : My id: %d, myStart: %d, myEnd: %d, Sträng:
\n", tid, myStart, myEnd, searchVector.at(i).c_str() );
}
}
ref is a global string holding the reference. searchVector is the
vector<string> holding the strings I look for. myHits are the hit a
certain thread registers.
If what am I doing wrong here..?
EDIT, post was gnarly, sorry! Now it ok