User manual

Table Of Contents
622
mikoC PRO for PIC32
MikroElektronika
memset
Prototype
void *memset(void *p1, char character, int n);
Description Function copies the value of the character into each of the rst n characters of the object pointed
by p1. The function returns address of the object pointed to by p1.
Example
char txt[] = “mikroElektronika”;
memset(txt, ‘a’, 2); // routine will copy the character ‘a’ into each of
the rst ‘n’ characters of the string ‘txt’,
strcat
Prototype
char *strcat(char *to, char *from);
Description Function appends a copy of the string from to the string to, overwriting the null character at the end
of to. Then, a terminating null character is added to the result. If copying takes place between objects
that overlap, the behavior is undened. to string must have enough space to store the result. The
function returns address of the object pointed to by to.
Example
char txt[] = “mikroElektronika”;
char *res;
txt[3] = 0;
res = strcat(txt, “_test”); // routine will append the ‘_test’ at the
place of the rst null character, adding terminating null character to the
result
// routine returns the address of the ‘txt’
string
strchr
Prototype
char *strchr(char *ptr, char chr);
Description Function locates the rst occurrence of character chr in the string ptr. The function returns a pointer
to the rst occurrence of character chr, or a null pointer if chr does not occur in ptr. The terminating
null character is considered to be a part of the string.
Example
char txt[] = “mikroElektronika”;
char *res;
res = strchr(txt, ‘E’); // routine will locate the character ‘E’ in the
‘txt’ string, and return the address of the character