Linux strncpy () and STRCAT usage Summary

Source: Internet
Author: User

Strcat prototype: Char *strcat (char *dest,const char *src);

Add the string src refers to at the end of the dest (overwrite ' + ' at the end of the dest) and add '% '. The memory areas referred to by SRC and dest cannot overlap and dest must have enough space to accommodate the SRC string.

strncpy () Prototype: char * strncpy (char *dest, const char *SRC, size_t N);

The parameter description dest is the target string pointer, and SRC is the source string pointer. strncpy () copies the first n characters of the string src to the string dest. The memory areas referred to by SRC and dest cannot overlap, and dest must have enough space to place n characters.

Unlike strcpy (), strncpy () does not append an end tag to dest ' \ ', so using strcat after strncpy () is problematic because it cannot be found.

Linux strncpy () and STRCAT usage Summary

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.