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