error is as stated in the topic above:
error C2440: '=' : cannot convert from 'char *' to 'char'
code is below
-
void handleOneLine(string string1)
-
{
-
char * cstr, *p;
-
int counter;
-
string str (string1);
-
char data1, data2, data3;
-
-
cstr = new char [str.size()+1];
-
strcpy (cstr, str.c_str());
-
-
// cstr now contains a c-string copy of str
-
-
int count = 0;
-
p=strtok (cstr,",");
-
count++;
-
while (p!=NULL)
-
{
-
p=strtok(NULL,",");
-
if( count == 1 )
-
{
-
data1 = p;
-
searchTree(treeObj->root ,data1);
-
}
-
else if( count == 2 )
-
{
-
data2 = p;
-
// treeNodeObj->setLeft(data2);
-
}
-
else if( count == 3 )
-
{
-
data3 = p;
-
// treeNodeObj->setRight(data3);
-
}
-
count++;
-
if( count == 3 )
-
break;
-
}
-
-
delete[] cstr;
-
}
-
the error is below:
-
error C2440: '=' : cannot convert from 'char *' to 'char'
-
1> There is no context in which this conversion is possible
-
and the lines from which the errors are caused are:
-
data1 = p;
-
data2 = p;
-
data3 = p;
-
how can i solve this problem?
i will check the forum every 5 mins so plz do check back if u have posted a qn for me..
thanks in advance :)