Examples of string functions in vb (1/7)

Source: Internet
Author: User

Examples of string functions in vb
Bcmp (memory content comparison) related functions bcmp, strcasecmp, strcmp, strcoll
, Strncmp, strncasecmp
Header file # include <string. h>
Define the function int bcmp (const void * s1, const void * s2, int n );
Function Description: bcmp () is used to compare the first n bytes in the memory interval specified by s1 and s2. If the parameter n is 0, 0 is returned.
If the memory content of parameters s1 and s2 are identical, the return value is 0. Otherwise, the return value is non-zero.
We recommend that you replace memcmp () with additional instructions.
For an example, refer to memcmp ().
Bcopy (copy memory content) related functions: memccpy, memcpy, memmove, strcpy, ctrncpy
Header file # include <string. h>
Define the void bcopy function (const void * src, void * dest, int n );
Function Description: bcopy () and memcpy () are used to copy the first n Bytes of memory content specified by src to the address specified by dest, however, the src parameter and the dest parameter are in the opposite position when being passed to the function.
We recommend that you replace memcpy () with an additional description of returned values.
Example # include <string. h>
Main ()
{
Char dest [30] = "string ()";
Char src [30] = "stringstring ";
Int I;
Bcopy (src, dest, 30);/* place the src pointer before */
Printf (bcopy (): ")
For (I = 0; I <30; I ++)
Printf ("% c", dest [I]);
Memcpy (dest src, 30);/* put the dest pointer on money */
Printf ('nmemcpy (): ');
For (I = 0; I <30; I ++)
Printf ("% c", dest [I]);
Run bcopy (): string
Memcpy (): string sring1 2 3 4 5 6 7

Related Article

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.