CAPL Script

StrnCpy

Syntax

void strncpy(char dest[], char src[], long max);

Function

This function copiessrctodest.maxindicates the size ofdestin bytes. The function ensures that there is a terminating '\0'. Thus, a maximum ofmax-1bytes are copied.

Parameters

dest Destination buffer

src

Source string

max

Is used to determine the maximum number of copied bytes.Must not be larger than the size ofdest.A maximum ofmax-1bytes are copied.Ifsrcis shorter than that, bytes are only copied until a terminating '\0' is encountered.

Return Values

variables {char s1[7] = "Vector";char s2 [32];}on key 'z'{Output to the Write-Window:strncpy (s2,s1,elcount(s2));write ("Result: %s",s2);Result: Vector}

strlen | strncat | strncmp | strncpy_off