![]() |
cannot convert parameter 1 from 'char' to 'const char *'
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: Code:
short CSQLBox::fnTest(const TCHAR *varInput)I have tried typecasting parameter 1 as: Code:
if(strcmp((const char*)szExtract, varInput)==0)Could anyone kindly offer me some suggestions. cheers, sanK |
Re: cannot convert parameter 1 from 'char' to 'const char *'
Perhaps you should tell us what a CS_CHAR is. I'm not up to Googling it. Since you're using it, you should know.
|
Re: cannot convert parameter 1 from 'char' to 'const char *'
Hello DaWei,
My code snippet belongs to an Embedded SQL file in C++. CS_CHAR is a character datatype used in Embedded SQL with Sybase and is declared within a EXEC SQL block. The actual code goes like this: Code:
short CSQLBox::fnTest(const TCHAR *varInput)sanK |
Re: cannot convert parameter 1 from 'char' to 'const char *'
Your first example has "CS_CHAR szExtract;"
Your second example has "CS_CHAR szExtract [10];" That's a fundamental difference. The first is a char, the second is a char*. You cannot reconcile that with a cast. Make sure you declare an array of char, not just one char. |
| All times are GMT +5.5. The time now is 18:28. |