cfunc.locate C Function/C Functions

cfunc.locate

Command cfunc.locate C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description equivalent to the Pick/BASIC statement: locate(string1, string2, ac.expression, vc.expression, start.expression, position.variable, string3) then result = 1 else result = 0

This function returns -1 if an error occurs. The error code is contained in _CP_errno.
Syntax int _CP_locate(int* result, CPSTR* string1, CPSTR* string2, int ac.expression, int vc.expression, int start.expression, int * position.variable, CPSTR* string3)
Options
Example
/* The following example prints "1 2". */

CPSTR * s = _CP_mkstr("a376b");
CPSTR * t = _CP_mkstr("b");
int r,l;

_CP_locate(&r,t,s,0,0,0,&l,_CP_str_null);
_CP_unix_env();
printf("%d %dn", r, l);
Purpose
Related cfunc.introduction