CAPL Script

SubStrCpy

Syntax

void substr_cpy(char dest[], char src[], long srcStart, long len, long max);

Function

This function copies a substring ofsrctodest.maxindicates the size ofdestin bytes. The function ensures that there is a terminating '\0'. Thus, a maximum of max-1 bytes are copied.

Parameters

dest Destination buffer

src

Source string

srcStart

Start index in bytes insrcof substring

len

Length of the substring in bytes, or -1 to copy the string until the end

max

Size ofdestin bytes

Return Values

char s1[7];char s2[18] = "Vector Informatik";substr_cpy(s1, s2, 0, 6, elcount(s1)); // s1: Vector

strstr