cfunc.locate

C Function/C Functions, Releases: AP 6.1

Pick/BASIC 'locate' functionality from C.

Syntax

int _CP_locate(int* result, CPSTR* string1, CPSTR* string2, int ac.expression, int vc.expression, int start.expression, int * position.variable, CPSTR* string3)

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.

Example

/* The following example prints '1 2'. */

CPSTR * s = _CP_mkstr('a\376b');
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 %d\n', r, l);

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.