The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


wcsncpy - copy part of a wide-character string


#include <wchar.h>

wchar_t *wcsncpy(wchar_t *ws1, const wchar_t *ws2, size_t n);


The wcsncpy() function copies not more than n wide-character codes (wide-character codes that follow a null wide-character code are not copied) from the array pointed to by ws2 to the array pointed to by ws1. If copying takes place between objects that overlap, the behaviour is undefined.

If the array pointed to by ws2 is a wide-character string that is shorter than n wide-character codes, null wide-character codes are appended to the copy in the array pointed to by ws1, until n wide-character codes in all are written.


The wcsncpy() function returns ws1; no return value is reserved to indicate an error.


No errors are defined.




Wide-character code movement is performed differently in different implementations. Thus overlapping moves may yield surprises.

If there is no null wide-character code in the first n wide-character codes of the array pointed to by ws2, the result will not be null-terminated.




wcscpy(), <wchar.h>.


Derived from the MSE working draft.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]