User manual

Table Of Contents
624
mikoC PRO for PIC32
MikroElektronika
strncat
Prototype
char *strncat(char *to, char *from, int size);
Description Function appends not more than size characters from the string from to to. The initial character of
from overwrites the null character at the end of to. The terminating null character is always appended
to the result. The function returns to.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro”;
char *result;
txt[5] = 0;
result = strncat(txt,txt_sub,4); // routine appends rst 4 characters
from the string ‘txt_sub’ at the place of rst null character in the ‘txt’
string
strncpy
Prototype
char *strncpy(char *to, char *from, int size);
Description Function copies not more than size characters from string from to to. If copying takes place
between objects that overlap, the behavior is undened. If from is shorter than size characters,
then to will be padded out with null characters to make up the difference. The function returns the
resulting string to.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro_test”;
int res;
res = strncpy(txt,txt_sub,4); // copies rst 4 characters form the string
‘txt_sub’ to ‘txt’
strspn
Prototype
int strspn(char *str1, char *str2);
Description Function returns the length of the maximum initial segment of str1 which consists entirely of characters
from str2. The terminating null character at the end of the string is not compared.
Example
char txt = “mikroElektronika”;
char txt_sub = “mikro_test”;
int res;
result = strspn(txt,txt_sub); // routne returns 4