UNIX Network Programming Reading Notes: byte manipulation functions

Source: Internet
Author: User

# Include <strings. h> bzero (* bcopy (* src, * bcmp (* ptr1, *-equal, non-0-not equal

Bzero sets the number of bytes in the target to 0;

Bcopy moves the specified number of bytes from the source to the target;

Bcmp compares any two byte strings. If the values are the same, the return value is 0. Otherwise, the return value is non-0.

# Include <. h> * memset (* dest, * memcpy (* dest, * memcmp (* ptr1, *-Same,> 0 or <-different

Memset sets the specified number of bytes to the value c;

Memcpy is similar to bcopy, But it exchanges the order of two pointer parameters. When the source and target overlap, bcopy can be correctly processed, and the memcpy operation result is unknown. In this case, the memmove function of ansi c must be used.

Memcmp compares any two byte strings. If the values are the same, 0 is returned. If the values are different, a non-0 value is returned. Whether it is greater than 0 or less than 0 depends on the first byte: if ptr1 is greater than ptr2, it is greater than 0; otherwise, it is less than 0. during the comparison operation, it is assumed that the two unequal bytes are unsigned characters (unsigned char ).

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.