wcsncpy

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

Library:LibC
Classification:ANSI
Service:Characters and Strings

Syntax

  #include <wchar.h> 
   
  wchar_t  *wcsncpy (
     wchar_t         *ws1,
     const wchar_t   *ws2,
     size_t           n);
  

Parameters

ws1

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

ws2

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

n

(IN) Specifies the number of wide characters to copy.

Return Values

Returns ws1.

Remarks

The wcsncpy function copies no more than n characters from the string pointed to by ws2 into the array pointed to by ws1. Wide character codes that follow a null-terminating wide-character code are not copied. Copying of overlapping objects is not guaranteed to work properly.

If the string pointed to by ws2 is shorter than n characters, NULL characters are appended to the copy in the array pointed to by ws1, until n characters in all have been written. If the string pointed to by ws2 is longer than n characters, only n characters are copied and the ws1 string is not null terminated.

See Also

wcscpy