I have a Byte array :
BYTE Buffer[20000];
this array contains the following data:
00FFFFFFFFFFFF0010AC4C4053433442341401030A2
Try this, just needed it:
// Returns a pointer to the first byte of needle inside haystack,
static uint8_t* bytes_find(uint8_t* haystack, size_t haystackLen, uint8_t* needle, size_t needleLen) {
if (needleLen > haystackLen) {
return false;
}
uint8_t* match = memchr(haystack, needle[0], haystackLen);
if (match != NULL) {
size_t remaining = haystackLen - ((uint8_t*)match - haystack);
if (needleLen <= remaining) {
if (memcmp(match, needle, needleLen) == 0) {
return match;
}
}
}
return NULL;
}