LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Operands of != have incompatible type

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

0 Kudos
Message 1 of 2
(4,222 Views)

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)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(4,213 Views)