Function _conCompare() Foundation

Compares two containers.

Syntax
XPPAPIRET _conCompare(LONG *cmp,
                      ContainerHandle ch1, ContainerHandle ch2);
Parameters
LONG *cmp
Pointer to a LONG value in which the result of the comparison is placed. If ch1 < ch2, this value is negative after the call. If ch1 = ch2, the value is NULL. If ch1 > ch2, the value is positive.
ContainerHandle ch1
First container whose content is to be compared.
ContainerHandle ch2
Second container whose content is to be compared.
Return

Returns an error code (XPP_ERR_...) if the containers are not of the same type.

Description

Using this function the comparison operators (<, <=, >=, >) of the Xbase++ language level become accessible to the C programmer. The comparison incorporates the current values of SET EXACT and SET LEXICAL.

Examples
/* 
Comparison of two string containers 
*/ 
#include <xppcon.h> 

XPPAPIRET       xr; 
ContainerHandle chs1, chs2; 
LONG            cmp; 

/* 
Generate and initialize string containers ... 
*/ 

xr = _conCompare( &cmp, chs1, chs2 ); 
if (xr == 0) 
{ 
if (cmp < 0) 
   /* chs1 less than chs2 ... */ 
else if (cmp > 0) 
   /* chs1 greater than chs2 ... */ 
else 
   /* chs1 equal to chs2 ... */ 
} 
/* 
Release of the string container ... 
*/ 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.