How to search in a BYTE array for a pattern?

后端 未结 4 1217
南旧
南旧 2021-01-04 09:02

I have a Byte array :

BYTE Buffer[20000]; this array contains the following data:

00FFFFFFFFFFFF0010AC4C4053433442341401030A2

4条回答
  •  时光取名叫无心
    2021-01-04 09:37

    You want something like memmem (that code is licensed with the GPL).

    However, it should not be difficult to roll your own. Like in memmem's implementation, you need a loop that uses memchr to find the first character of your needle in the haystack, and memcmp to test each hit and see if all of your needle is there.

提交回复
热议问题