仿strstr()搜索指定子數組
uint8_t* memstr(const uint8_t * buf1, const uint8_t * buf2,unsigned int buf1len, unsigned int count) {
unsigned int i = 0;
for (i = 0; i < buf1len- count; i++) {
if (memcmp(buf1+i, buf2, count) == 0) {
return (uint8_t*)(buf1 + i);
}
}
return NULL;
}