01-14-2015 07:28 AM
Hi,
I have the following problem when compiling my fonction:
"int f_ReceiveCom(int portCom, char EndTerm, int CountTerm, char *buffer,double timOUT)
{
int Index=0,
Compt=0;
char Oxbuffer[1024];
memset(buffer,'\0',1024);
memset(Oxbuffer,'\0',1024);
SetComTime (portCom, timOUT);
if(EndTerm != NULL)
{
do
{
"
i got the following error "Operands of != have incompatible type", i tried with strcmp but it does not work
can anybody have idea about why this issue happen, <hy i cannot compare these two terms.
Regards,
SASA
01-14-2015 08:55 AM - edited 01-14-2015 08:56 AM
NULL is defined as a (void *) and is not comparable with a char.
If you want to test for char not zero you can simply use if (EndTerm) { }
On the other end, a char is not a string (which should be a char *) and cannot be used inside strcmp instruction. A char can be treated as an integer value (it actually is an 8-byte integer)