How to compare two string?
Why the two string is equal?


        uchar *p1 = (uchar*)str.c_str(), *p2 = (uchar*)str.c_str();


Both p1 and p2 point to the same string so of course they will always compare equal.



Do you mean:

if (str == card)
   // do something