emadrezvani
پنج شنبه 19 تیر 1393, 13:02 عصر
کدویژن string.h مگه نداره ؟!
CodeVisionAVR
© 1998-2007 HP InfoTech S.R.L.
Page 123
4.5 String Functions
The prototypes for these func
tions are placed in the file
string.h
, located in the ..\INC subdirectory.
This file must be
#include
-ed before using the functions.
The string manipulation functions were extended to
handle strings located both in SRAM and FLASH
memories.
char *strcat(char *str1, char *str2)
concatenate the string str2
to the end of the string str1.
char *strcatf(char *str1, char flash *str2)
concatenate the string str2, located in
FLASH, to the end of the string str1.
char *strncat(char *str1, char *str2, unsigned char n)
concatenate maximum n characters of the st
ring str2 to the end of the string str1.
Returns a pointer to the string str1.
char *strncatf(char *str1, char flash *str2, unsigned char n)
concatenate maximum n characters of the string
str2, located in FLASH, to the end of the string
str1.
Returns a pointer to the string str1.
char *strchr(char *str, char c)
returns a pointer to the first occurrence of the
character c in the string str, else a NULL pointer.
char *strrchr(char *str, char c)
returns a pointer to the last occurrence of the
character c in the string str, else a NULL pointer.
signed char strpos(char *str, char c)
returns the index to first occurrence of
the character c in the string str, else -1.
signed char strrpos(char *str, char c)
returns the index to the last occurrence of
the character c in the string str, else -1.
signed char strcmp(char *str1, char *str2)
compares the string str1 with the string str2.
Returns <0, 0, >0 according to st
r1<str2, str1=str2, str1>str2.
signed char strcmpf(char *str1, char flash *str2)
compares the string str1, located in SRAM
, with the string str2, located in FLASH.
Returns <0, 0, >0 according to st
r1<str2, str1=str2, str1>str2.
signed char strncmp(char *str1, char *str2, unsigned char n)
compares at most n characters of
the string str1 with the string str2.
Returns <0, 0, >0 according to st
r1<str2, str1=str2, str1>str2.
CodeVisionAVR
© 1998-2007 HP InfoTech S.R.L.
Page 124
signed char strncmpf(char *str1, char flash *str2, unsigned char n)
compares at most n characters of
the string str1, located in SRAM, with the string str2, located in
FLASH.
Returns <0, 0, >0 according to st
r1<str2, str1=str2, str1>str2.
char *strcpy(char *dest, char *src)
copies the string src to the string dest.
char *strcpyf(char *dest, char flash *src)
copies the string src, located in FL
ASH, to the string dest, located in SRAM.
Returns a pointer to the string dest.
char *strncpy(char *dest, char *src, unsigned char n)
copies at most n characters from the
string src to the string dest (null padding).
Returns a pointer to the string dest.
char *strncpyf(char *dest, char flash *src, unsigned char n)
copies at most n characters from the string src,
located in FLASH, to the string dest, located in
SRAM (null padding).
Returns a pointer to the string dest.
unsigned char strspn(char *str, char *set)
returns the index of the first character, from the
string str, that doesn't
match a character from the
string set.
If all characters from set are in str returns the length of str.
unsigned char strspnf(char *str, char flash *set)
returns the index of the first character, from the
string str, located in SRAM, that doesn't match a
character from the string set, located in FLASH.
If all characters from set are in str returns the length of str.
unsigned char strcspn(char *str, char *set)
searches the string str for the first occu
rrence of a character from the string set.
If there is a match returns, the
index of the character in str.
If there are no matching characters, returns the length of str.
unsigned char strcspnf(char *str, char flash *set)
searches the string str for the first occurrence of
a character from the string set, located in FLASH.
If there is a match, returns the
index of the character in str.
If there are no matching characters, returns the length of str.
char *strpbrk(char *str, char *set)
searches the string str for the first oc
currence of a char from the string set.
If there is a match, returns a pointer to the character in str.
If there are no matching characters, returns a NULL pointer.
CodeVisionAVR
© 1998-2007 HP InfoTech S.R.L.
Page 125
char *strpbrkf(char *str, char flash *set)
searches the string str, located in SRAM, for the
first occurrence of a char from the string set,
located in FLASH.
If there is a match, returns a pointer to the character in str.
If there are no matching characters, returns a NULL pointer.
char *strrpbrk(char *str, char *set)
searches the string str for the last occu
rrence of a character from the string set.
If there is a match, returns a pointer to the character in str.
If there are no matching characters, returns a NULL pointer.
char *strrpbrkf(char *str, char flash *set)
searches the string str, located in SRAM, for the la
st occurrence of a character from the string set,
located in FLASH.
If there is a match, returns a pointer to the character in str.
If there are no matching characters, returns a NULL pointer.
char *strstr(char *str1, char *str2)
searches the string str1 for the fi
rst occurrence of the string str2.
If there is a match, returns a pointer to the character in str1 where str2 begins.
If there is no match, returns a NULL pointer.
char *strstrf(char *str1, char flash *str2)
searches the string str1, located in SRAM, for t
he first occurrence of the string str2, located in
FLASH.
If there is a match, returns a pointer to the character in str1 where str2 begins.
If there is no match, returns a NULL pointer.
char *strtok(char *str1, char flash *str2)
scans the string str1, located in SRAM, for the firs
t token not contained in the string str2, located in
FLASH.
The function considers the string str1 as consisting of a sequence of text tokens, separated by spans
of one or more characters from the string str2.
The first call to strtok, with the pointer to str1 bei
ng different from NULL, returns a pointer to the first
character of the first token in str1. Also a NULL ch
aracter will be written in str1, immediately after the
returned token.
Subsequent calls to strtok, with
NULL as the first parameter, will work
through the string str1 until no
more tokens remain. When there are no more
tokens, strtok will
return a NULL pointer.
unsigned char strlen(char *str)
for the TINY memory model.
returns the length of the string str (in the
range 0..255), excluding the null terminator.
unsigned int strlen(char *str)
for the SMALL memory model.
returns the length of the string str (in the r
ange 0..65535 ), excluding the null terminator.
unsigned int strlenf(char flash *str)
returns the length of the string str located in FLASH, excluding the null terminator.
CodeVisionAVR
© 1998-2007 HP InfoTech S.R.L.
Page 126
void *memcpy(void *dest,void *src, unsigned char n)
for the TINY memory model.
void *memcpy(void *dest,void *src, unsigned int n)
for the SMALL memory model.
Copies n bytes from src to dest. dest
must not overlap src, else use
memmove
.
Returns a pointer to dest.
void *memcpyf(void *dest,void flash *src, unsigned char n)
for the TINY memory model.
void *memcpyf(void *dest,void flash *src, unsigned int n)
for the SMALL memory model.
Copies n bytes from src, located in FL
ASH, to dest. Returns a pointer to dest.
void *memccpy(void *dest,void *src, char c, unsigned char n)
for the TINY memory model.
void *memccpy(void *dest,void *src, char c, unsigned int n)
for the SMALL memory model.
Copies at most n bytes from src to
dest, until the character c is copied.
dest must not overlap src.
Returns a NULL pointer if the last copied character was c or a pointer to dest+n+1.
void *memmove(void *dest,void *src, unsigned char n)
for the TINY memory model.
void *memmove(void *dest,void *src, unsigned int n)
for the SMALL memory model.
Copies n bytes from src to dest. dest may overlap src.
Returns a pointer to dest.
void *memchr(void *buf, unsigned char c, unsigned char n)
for the TINY memory model.
void *memchr(void *buf, unsigned char c, unsigned int n)
for the SMALL memory model.
Scans n bytes from buf for byte c.
Returns a pointer to c if found or a NULL pointer if not found.
signed char memcmp(void *buf1,void *buf2, unsigned char n)
for the TINY memory model.
CodeVisionAVR
© 1998-2007 HP InfoTech S.R.L.
Page 127
signed char memcmp(void *buf1,void *buf2, unsigned int n)
for the SMALL memory model.
Compares at most n bytes of buf1 with buf2.
Returns <0, 0, >0 according to buf1<buf2, buf1=buf2, buf1>buf2.
signed char memcmpf(void *buf1,void flash *buf2, unsigned char n)
for the TINY memory model.
signed char memcmpf(void *buf1,void flash *buf2, unsigned int n)
for the SMALL memory model.
Compares at most n bytes of buf1, locat
ed in SRAM, with buf2, located in FLASH.
Returns <0, 0, >0 according to buf1<buf2, buf1=buf2, buf1>buf2.
void *memset(void *buf, unsigned char c, unsigned char n)
for the TINY memory model.
void *memset(void *buf, unsigned char c, unsigned int n)
for the SMALL memory model.
Sets n bytes from buf with byte c. Returns a pointer to buf.
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.