The example below demonstrates how to use memory movement functions from the alternative C library.
#include <stdio.h>
#include "ST_API.h"
int main(void)
{
int Cmp;
char Buffer1[10];
char Buffer2[10] = "ZZZZABCZ";
/* Initialization */
arInit();
stInit();
/* Fill Buffer1 with 'Z' characters */
stMemSet(Buffer1, 'Z', 8);
/* Store "ABC" in Buffer1, beginning from fourth character */
stMemCpy(&Buffer1[4], "ABC", 3);
/* Compare buffer data */
Cmp = stMemCmp(Buffer1, Buffer2, 8);
if(Cmp < 0)
printf("Buffer1 is less than Buffer2.\n");
if(Cmp > 0)
printf("Buffer1 is greater than Buffer2.\n");
if(Cmp == 0)
printf("Buffer1 is equal to Buffer2.\n");
/* Deinitialization */
arDeinit();
return 0;
}