Re: Comparing strings pointed by * CStringA
On 1 Wrz, 10:34, "Giovanni Dicanio"
<giovanniDOTdica...@REMOVEMEgmail.com> wrote:
<woj...@gmail.com> ha scritto nel messaggionews:6919bf24-d4ae-4500-bd95-7=
59018406993@w7g2000hsa.googlegroups.com...
retirve values from my table. If column insqlvas "varchar" , the
object of CDBVariant is *CStringA type. I need to compare two
pointers of CStringA . For example prt1 points on "ID1" and ptr2
points on "ID2". If there is a CStringA type, there is no problem, but
when i got pointers to CStringA types, i completly dont know how to
compare strings pointed by them.
Please correct me if I'm wrong, but my understanding is that you have:
CStringA * pstr1 ...
CStringA * pstr2 ...
and you want co compare pstr1 with pstr2.
If you had
// no pointers
CStringA str1 ...
CStringA str2 ...
you would probably do str1.Compare( str2 ).
If you have pointers, you can dereference them:
pstr1->Compare( *pstr2 );
Which is equivalent to more verbose:
(*pstr1).Compare( *pstr2 );
Basically, if 'pstr' is a 'CStringA *', then '*pstr' is a 'CStringA'.
HTH,
Giovanni
Yes, that is what i was looking for. Another thing is that i got
"strange" errors when im trying to retrive data from database - code
below:
CDBVariant varValue;
CStringA *pstr;
pstr = new CStringA;
pstr = varValue.m_pstringA;
when im using Find method i got unhandled exeption and complier visual
stopts at " int GetLength() const throw()
{
return( GetData()->nDataLength );
}" from altsimpstr.h
im typieg :
pstr -> Find(_T("ID0"),0)
when im debugging, and move coursor at that line, it shows me : psrt =
<Bad Ptr>
why ? whats wrong ?
WJ
(now pstr is "ID0ID2ID3")