##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# wcsncpy

From cppreference.com
< c‎ | string‎ | wide

Defined in header `<wchar.h>` |  |
wchar_t* wcsncpy( wchar_t* dest, const wchar_t* src, size_t count ); |  |

Copies at most `count` characters of the wide string pointed to by `src` (including the terminating null wide character) to wide character array pointed to by `dest`.

If `count` is reached before the entire string `src` was copied, the resulting wide character array is not null-terminated.

If, after copying the terminating null wide character from `src`, `count` is not reached, additional null wide characters are written to `dest` until the total of `count` characters have been written.

If the strings overlap, the behavior is undefined.

### [edit] Parameters

dest | - | pointer to the wide character array to copy to
src | - | pointer to the wide string to copy from
count | - | maximum number of wide characters to copy

### [edit] Return value

`dest`

### [edit] Notes

In typical usage, `count` is the size of the destination array.

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

wcscpy | copies one wide string to another (function) [edit]
wmemcpy | copies a certain amount of wide characters between two non-overlapping arrays (function) [edit]
C++ documentation for wcsncpy

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/string/wide/wcsncpy&oldid=56858"
Category:

- Todo no example