Copy a part of a string

Description

strncpy(s1{}, const s2{}, len=sizeof(s1), ofs=0

Copy a substring.

Parameters

s1 Destination
s2 Source string
len Max number of characters to compare
ofs Starting offset in s2

Return value

Returns the number of bytes copied

Example usage

 
    new mystring{} = "This is a test"; 
    new s{80}, x;
 
    x = strncpy(s, mystring, 3, 1);
    // x = 3, s = "his"
 
  • ezeio2/scriptref/strncpy.txt
  • Last modified: 2026-12-02 17:12
  • by andreh