cfunc.compare C Function/C Functions

cfunc.compare

Command cfunc.compare C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description equivalent to the Pick/BASIC statement: result = (string1 = string2)

This function has the following return codes:

-1 string1 < string2
0 string1 = string2
1 string1 > string2
Syntax int _CP_compare(int* result, CPSTR* string1, CPSTR* string2)
Options
Example
CPSTR * s = _CP_mkstr("a");
CPSTR * t = _CP_mkstr("A");
int i;        

_CP_unix_env();
/* default is casing off - print 0 */
_CP_compare(&i,s,t);
printf("%dn",i);
/* turn casing on - print 1 */
_CP_casing(1);
_CP_compare(&i,s,t);
printf("%dn",i);
Purpose
Related cfunc.introduction