Dear Experts,
I am stuck up with a piece of code, which I am not able to break. Could you kindly help me out.
Situation:
I am trying to perform a string comparison between 2 variables, one defined as const TCHAR * and other defined as CS_CHAR, inside an Embedded SQL program in C++. My relevant code snippet is as below:
=====
short CSQLBox::fnTest(const TCHAR *varInput)
{
CS_CHAR szExtract;
//szExtract variable is populated by Embedded SQL query
....
//Do string comparison
if(strcmp(szExtract, varInput)==0)
{
...
}
}
=====
When I try to compile this code, the strcmp step is throwing an error "cannot convert parameter 1 from 'char' to 'const char *'".
I have tried typecasting parameter 1 as:
if(strcmp((const char*)szExtract, varInput)==0)
This way, the code compiles, but fails in runtime with unhandled exception error. I am unable to understand how to solve this issue.
Could anyone kindly offer me some suggestions.
cheers,
sanK
I am stuck up with a piece of code, which I am not able to break. Could you kindly help me out.
Situation:
I am trying to perform a string comparison between 2 variables, one defined as const TCHAR * and other defined as CS_CHAR, inside an Embedded SQL program in C++. My relevant code snippet is as below:
=====
short CSQLBox::fnTest(const TCHAR *varInput)
{
CS_CHAR szExtract;
//szExtract variable is populated by Embedded SQL query
....
//Do string comparison
if(strcmp(szExtract, varInput)==0)
{
...
}
}
=====
When I try to compile this code, the strcmp step is throwing an error "cannot convert parameter 1 from 'char' to 'const char *'".
I have tried typecasting parameter 1 as:
if(strcmp((const char*)szExtract, varInput)==0)
This way, the code compiles, but fails in runtime with unhandled exception error. I am unable to understand how to solve this issue.
Could anyone kindly offer me some suggestions.
cheers,
sanK