PDA

View Full Version : doubt



AnithaRagupathy
8th February 2008, 05:49
hi,
i am trying to replace the below code in vc++

LPCSTR p1,p;
if (*p1 == *p++)
return p1+1;

what i have done till now is


QChar *str1data,strp;
if (str1data == strp++)
{
return str1data+1;
}
compile error that i am getting :QString::QString(QChar)' : cannot convert parameter 1 from 'QChar *' to 'QChar

What should be done regarding this? I am poor in programming plz bear with me...

TimButterfield
8th February 2008, 07:06
It has been a long day and I am kind of tired. I hope I am writing this correctly. You were declaring one "pointer to QChar" and one "QChar". If you want both variables to be pointers, you can declare them like this (* before both variable names):



QChar *str1data, *strp;
if (str1data == strp++)
{
return str1data+1;
}


Or, you could create a typedef and use that for both as in this example code.



typedef QChar* QCharP;
QCharP str1data, strp;
if (str1data == strp++)
{
return str1data+1;
}