cfunc.compare

C Function/C Functions, Releases: AP 6.1

Pick/BASIC comparison functionality from C.

Syntax

int _CP_compare(int* result, CPSTR* string1, CPSTR* string2)

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

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('%d\n',i);
/* turn casing on - print 1 */
_CP_casing(1);
_CP_compare(&i,s,t);
printf('%d\n',i);

See Also

Command Name Type Description
cfunc.introduction Introductory Overview

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.