_mbsnbcpy
Copies n bytes of a string to a destination string.
unsigned char * _mbsnbcpy( unsigned char * strDest, const unsigned char * strSource, size_t count );
Parameters
- strDest
- Destination for character string to be copied.
- strSource
- Character string to be copied.
- count
- Number of bytes to be copied.
Return Value
_mbsnbcpy returns a pointer to the destination character string. No return value is reserved to indicate an error.
Remarks
The _mbsnbcpy function copies count bytes from strSource to strDest. If count is less than or equal to the size in bytes of strSource, a null character is not appended automatically to the copied string. If size in bytes of strSource is less than count, the destination buffer is padded with null characters. If count exceeds the size of strDest, or if the source and destination strings overlap, the behavior of _mbstrncpy is undefined.
Security Note This API incurs a potential threat brought about by a buffer overrun problem. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see Avoiding Buffer Overruns.
Generic-Text Routine Mappings
| TCHAR.H routine | _UNICODE & _MBCS not defined | _MBCS defined | _UNICODE defined |
|---|---|---|---|
| _tcsncpy | strncpy | _mbsnbcpy | wcsncpy |
Requirements
| Routine | Required header | Compatibility |
|---|---|---|
| _mbsnbcpy | <mbstring.h> | Win 98, Win Me, Win NT, Win 2000, Win XP |
For additional compatibility information, see Compatibility in the Introduction.
Libraries
All versions of the C run-time libraries.
See Also
String Manipulation Routines | _mbsnbcat | _mbsnbcmp | _mbsnbcnt, _mbsnccnt | _mbsnbicmp | _mbsnbset | _mbsncpy | Run-Time Routines and .NET Framework Equivalents