A little difference between Lstrcpyn and strncpy

Source: Internet
Author: User

These two functions are similar in function and are easy to use wrong.
LPTSTR Lstrcpyn (LPTSTR lpString1, LPCTSTR lpString2, int imaxlength);
TCHAR lpString2 lpString1 WCHAR values for Unicode versions.
from the lpString2 to the lpString1 Replication imaxlength bytes, including/0, which is the actual copy of iMaxLength-1 bytes
Char *strncpy (   char *strdest,   const char *strsource,   count );

The strncpy function copies the initial count characters of strsource to strdest and R Eturns strdest. If Count is less than or equal to the length of strsource, a null character are not appended Automaticall Y to the copied string. If Count is greater than the length of strsource, the destination string was padded with null characters Up to length count. The behavior of strncpy is undefined if the source and destination strings overlap.

Fromstrsource tocopy Count bytes in strdest, ifstrsource length is not enough, the following bytes are/0 padded

A little difference between Lstrcpyn and strncpy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.