utf8ncpy

Copies a specified number of characters from one string to another string.

Library:LibC
Service:Characters and Strings

Syntax

  #include <utf8.h> 
   
  utf8_t *utf8ncpy (
     utf8_t        *tgt,
     const utf8_t  *src,
     size_t         n);
  

Parameters

tgt

(OUT) Points to the array into which to copy the characters.

src

(IN) Points to the string containing the characters to copy.

n

(IN) Specifies the number of characters to copy.

Return Values

Returns the value of tgt.

Remarks

The utf8ncpy function copies no more than the number of characters specified by the n parameter. Copying overlapping objects is not guaranteed to work properly.

If the string pointed to by src is shorter than n characters, null-terminating characters are appended to the copy in the array pointed to by tgt, until n characters in all have been written. If the string pointed to by src is longer than n characters, only n characters are copied and no null-terminating characters are placed in tgt.

The utf8ncpy function works the same as its ANSI/ISO equivalent, strncpy, except that utf8ncpy works on strings containing UTF-8 characters, which can be composed of one or two bytes. UTF-8 characters can require up to six bytes total, but NetWare does not generate such characters.

See Also