Duplicates the first n bytes of a string, returning a newly-allocated
buffer n + 1 bytes long which will always be nul-terminated.
If str is less than n bytes long the buffer is padded with nuls.
If str is NULL it returns NULL.
The returned value should be freed when no longer needed.
Note
To copy a number of characters from a UTF-8 encoded string, use
g_utf8_strncpy() instead.
Duplicates the first n bytes of a string, returning a newly-allocated buffer n + 1 bytes long which will always be nul-terminated. If str is less than n bytes long the buffer is padded with nuls. If str is NULL it returns NULL. The returned value should be freed when no longer needed. Note To copy a number of characters from a UTF-8 encoded string, use g_utf8_strncpy() instead.