This documentation is archived and is not being maintained.


Appends, at most, the first n bytes of one multibyte character string to another.

unsigned char *_mbsnbcat(
   unsigned char *dest,
   const unsigned char *src,
   size_t count 


Null-terminated multibyte-character destination string.
Null-terminated multibyte-character source string.
Number of bytes from src to append to dest.

Return Value

_mbsnbcat returns a pointer to the destination string. No return value is reserved to indicate an error.


The _mbsnbcat function appends, at most, the first count bytes of src to dest. If the byte immediately preceding the null character in dest is a lead byte, the initial byte of src overwrites this lead byte. Otherwise the initial byte of src overwrites the terminating null character of dest. If a null byte appears in src before count bytes are appended, _mbsnbcat appends all bytes from src, up to the null character. If count is greater than the length of src, the length of src is used in place of count. The resulting string is terminated with a null character. If copying takes place between strings that overlap, the behavior is undefined.

Security Note   Use a null-terminated string. The null-terminated string must not exceed the size of the destination buffer. For more information, see Avoiding Buffer Overruns.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_tcsncat strncat _mbsnbcat wcsncat


Routine Required header Compatibility
_mbsnbcat <mbstring.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

String Manipulation Routines | _mbsnbcmp | _mbsnbcnt, _mbsnccnt | _mbsnbcpy | _mbsnbicmp | _mbsnbset | strncat | Run-Time Routines and .NET Framework Equivalents