#include <strings.h>
Link against:
libc.lib
bcmp(const void *,const void *,size_t)
Interface status: |
externallyDefinedApi |
|
IMPORT_C int bcmp(const void *, const void *, size_t);
Description
The bcmp function compares byte string b1 against byte string b2, returning zero if they are identical and non-zero otherwise.
Both strings are assumed to be length bytes long. Zero-length strings are always identical.
The strings may overlap.
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
int ret = 0;
ret = bcmp("a","a",1);
printf("bcmp(\"a\",\"a\",1) is %d",ret);
ret = bcmp("abcd","abce",4);
printf("
bcmp(\"abcd\",\"abce\",1) is %d",ret);
ret = bcmp("abc","xyz",0);
printf("
bcmp(\"abc\",\"xyz\",0) is %d",ret);
return 0;
}
Output
bcmp("a","a",1) is 0
bcmp("abcd","abce",1) is -1
bcmp("abc","xyz",0) is 0
Parameters
Return value
int |
bcmp function returns 0 if the byte sequences are equal and non-zero otherwise.
|
|
See also:
memcmp(const void *,const void *,size_t)
memcmp(const void *,const void *,size_t)
strcasecmp(const char *,const char *)
strcasecmp(const char *,const char *)
Compares the null-terminated strings left and right and returns an integer great...
strcmp(const char *,const char *)
strcmp(const char *,const char *)
Compare two strings. Compares string1 to s1 character by character. This functio...
strcoll(const char *,const char *)
strxfrm(char *,const char *,size_t)
strxfrm(char *,const char *,size_t)
Transform string using locale settings. Copies the first num characters of src t...
bcopy(const void *,void *,size_t)
Interface status: |
externallyDefinedApi |
|
IMPORT_C void bcopy(const void *, void *, size_t);
Description
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
char dst[50];
bcopy("Hello World",dst,12);
printf("Destination string after bcopy = %s
",dst);
return 0;
}
Output
Destination string after bcopy = Hello World
Parameters
const void * |
|
void * |
|
size_t size_t
|
The bcopy function copies length bytes from string src0 to string dst0 . The two strings may overlap. If length is zero no
bytes are copied.
|
|
See also:
memccpy(void *,const void *,int,size_t)
memccpy(void *,const void *,int,size_t)
...
memcpy(TAny *,const TAny *,unsigned int)
memcpy(TAny *,const TAny *,unsigned int)
A Nanokernel utility function that copies bytes in memory.
memmove(TAny *,const TAny *,unsigned int)
memmove(TAny *,const TAny *,unsigned int)
A Nanokernel utility function that moves (copies) bytes in memory.
strcpy(char *,const char *)
strcpy(char *,const char *)
Copy string. Copies the content pointed by src to dest stopping after the termin...
Interface status: |
externallyDefinedApi |
|
IMPORT_C void bzero(void *, size_t);
Description
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
char dst[50] = "abcdef";
bzero(dst + 2, 2);
if(!strcmp(dst, "ab")) printf("dst = %s
",dst);
if(!strcmp(dst+3, "")) printf("zeros added to dst string
");
if(!strcmp(dst + 4, "ef")) printf("dst + 4 = %s
",dst);
return 0;
}
Output
dst = ab
zeros added to dst string
dst + 4 = ab
Parameters
void * |
|
size_t size_t
|
The bzero function writes len zero bytes to the string b. If len is zero, bzero does nothing.
|
|
See also:
Interface status: |
externallyDefinedApi |
|
IMPORT_C int ffs(int);
Description
The ffs and ffsl functions find the first bit set in mask and return the index of that bit.
The fls and flsl functions find the last bit set in mask and return the index of that bit.
Bits are numbered starting from 1, starting at the right-most (least significant) bit. A return value of zero from any of
these functions means that the argument was zero.
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
int i = 0x10;
int j = ffs(i);
if(j == 5) printf("First bit position in 0x10 is %d
",j);
return 0;
}
Output
First bit position in 0x10 is 5
Parameters
int |
Note: This description also covers the following functions - ffsl() fls() flsl()
|
|
Return value
Interface status: |
externallyDefinedApi |
|
IMPORT_C char* index(const char *, int);
Description
The index function locates the first occurrence of ch (converted to a char ) in the string pointed to by p. The terminating
null character is considered part of the string; therefore if ch is ‘\0,’ the functions locate the terminating ‘\0.’
The rindex function is identical to index, except it locates the last occurrence of ch.
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
char one[50];
char* ret;
strcpy(one,"abcd");
ret = index(one, ’c’);
if(!strncmp(one+2,ret,1)) printf("index of \ ’c\ ’ in string \"abcd\" is %d \n",2);
ret = index(one, ’z’);
if(ret == NULL) printf("\ ’z\ ’ not found in string \"abcd\"\n");
ret = index(one, ’\0’);
if(!strncmp(one+4,ret,1)) printf("index of \ ’\ \0\ ’ in string \"abcd\" is %d\n",4);
strcpy(one,"cdcab");
ret = rindex(one, ’c’);
if(!strncmp(one+2,ret,1)) printf("rindex of \ ’c\ ’ in string \"cscab\" is %d\n",2);
strcpy(one,"dcab");
ret = rindex(one, ’\0’);
if(!strncmp(one+4,ret,1)) printf("index of \ ’\ \0\ ’ in string \"dcab\" is %d\n",4);
return 0;
}
Output
index of ’c’ in string "abcd" is 2
’z’ not found in string "abcd"
index of ’\0’ in string "abcd" is 4
rindex of ’c’ in string "cscab" is 2
index of ’\0’ in string "dcab" is 4
Parameters
Return value
char * |
The functions index and rindex return a pointer to the located character, or NULL if the character does not appear in the
string.
|
|
See also:
memchr(const void *,int,size_t)
memchr(const void *,int,size_t)
Search buffer for a character. Searches the first num bytes of memory block poin...
strchr(const char *,int)
strchr(const char *,int)
Find character in string. Returns the first occurrence of i in string. The null-...
strcspn(const char *,const char *)
strcspn(const char *,const char *)
Search string for occurrence of character set. Scans s1 character by character, ...
strpbrk(const char *,const char *)
strsep(char **,const char *)
strsep(char **,const char *)
...
strspn(const char *,const char *)
strspn(const char *,const char *)
Get length of substring composed of given characters. Scans s1 character by char...
strstr(const char *,const char *)
strstr(const char *,const char *)
Find substring. Scans string1 for the first occurrence of string2. The search do...
strtok(char *,const char *)
Interface status: |
externallyDefinedApi |
|
IMPORT_C char* rindex(const char *, int);
Description
Parameters
Return value
See also:
memchr(const void *,int,size_t)
memchr(const void *,int,size_t)
Search buffer for a character. Searches the first num bytes of memory block poin...
strchr(const char *,int)
strchr(const char *,int)
Find character in string. Returns the first occurrence of i in string. The null-...
strcspn(const char *,const char *)
strcspn(const char *,const char *)
Search string for occurrence of character set. Scans s1 character by character, ...
strpbrk(const char *,const char *)
strsep(char **,const char *)
strsep(char **,const char *)
...
strspn(const char *,const char *)
strspn(const char *,const char *)
Get length of substring composed of given characters. Scans s1 character by char...
strstr(const char *,const char *)
strstr(const char *,const char *)
Find substring. Scans string1 for the first occurrence of string2. The search do...
strtok(char *,const char *)
strcasecmp(const char *,const char *)
Interface status: |
externallyDefinedApi |
|
IMPORT_C int strcasecmp(const char *, const char *);
Description
The strcasecmp and strncasecmp functions compare the null-terminated strings s1 and s2. The strcasecmp(const char *,const char *)
strcasecmp(const char *,const char *)
function compares the two strings s1 and s2 , ignoring the case of the characters.
The strncasecmp compares at most len characters.
Examples:
#include <string.h>
#include <stdio.h>
int main()
{
int ret;
ret = strcasecmp("ABC","abc");
printf("strcasecmp of \"ABC\" \"abc\" is %d
",ret);
ret = strcasecmp("abc","abc");
printf("strcasecmp of \"abc\" \"abc\" is %d
",ret);
return 0;
}
Output
strcasecmp of "ABC" "abc" is 0
strcasecmp of "abc" "abc" is 0
Parameters
Return value
int |
The strcasecmp and strncasecmp return an integer greater than, equal to, or less than 0, according to whether s1 is lexicographically
greater than, equal to, or less than s2 after translation of each corresponding character to lower-case. The strings themselves
are not modified.
|
|
See also:
bcmp(const void *,const void *,size_t)
bcmp(const void *,const void *,size_t)
...
memcmp(const void *,const void *,size_t)
memcmp(const void *,const void *,size_t)
strcmp(const char *,const char *)
strcmp(const char *,const char *)
Compare two strings. Compares string1 to s1 character by character. This functio...
strcoll(const char *,const char *)
strxfrm(char *,const char *,size_t)
strxfrm(char *,const char *,size_t)
Transform string using locale settings. Copies the first num characters of src t...
tolower(int)
tolower(int)
Tests whether the character is lowercase.
strncasecmp(const char *,const char *,size_t)
Interface status: |
externallyDefinedApi |
|
IMPORT_C int strncasecmp(const char *, const char *, size_t);
Description
Parameters
Return value
See also:
bcmp(const void *,const void *,size_t)
bcmp(const void *,const void *,size_t)
...
memcmp(const void *,const void *,size_t)
memcmp(const void *,const void *,size_t)
strcmp(const char *,const char *)
strcmp(const char *,const char *)
Compare two strings. Compares string1 to s1 character by character. This functio...
strcoll(const char *,const char *)
strxfrm(char *,const char *,size_t)
strxfrm(char *,const char *,size_t)
Transform string using locale settings. Copies the first num characters of src t...
tolower(int)
tolower(int)
Tests whether the character is lowercase.