User manual

Table Of Contents
620
mikoC PRO for PIC32
MikroElektronika
ANSI C String Library
The mikroC PRO for PIC32 provides a set of standard ANSI C library functions useful for manipulating strings and RAM
memory.
Important:
- Not all of the standard functions have been included.
- The functions have been mostly implemented according to the ANSI C standard, but certain functions have been
modied in order to facilitate PIC32 programming. Be sure to skim through the description before using standard C
functions.
Library Functions
- memchr
- memcmp
- memcpy
- memmove
- memset
- strcat
- strchr
- strcmp
- strcpy
- strlen
- strncat
- strncpy
- strspn
- strncmp
- strstr
- strcspn
- strpbrk
- strrchr
- strtok
memchr
Prototype
void *memchr(void *p, char n, unsigned int v);
Description Function locates the rst occurrence of char n in the initial v bytes of memory area starting at the
address p. The function returns the pointer to this location or 0 if the n was not found.
For parameter p you can use either a numerical value (literal/variable/constant) indicating memory
address or a dereferenced value of an object, for example &mystring or &PORTB.
Example
char txt[] = “mikroElektronika”;
res = memchr(txt, ‘e’, 16); // example locates rst occurrence of the
letter ‘e’ in the string ‘txt’ in the rst 16 characters of the string