A pure bytes version of strstr?

后端 未结 3 991
失恋的感觉
失恋的感觉 2021-01-17 15:08

Is there a version of strstr that works over a fixed length of memory that may include null characters?

I could phrase my question like this: strncpy is to memcpy as

3条回答
  •  清歌不尽
    2021-01-17 15:35

    memmem, unfortunately it's GNU-specific rather than standard C. However, it's open-source so you can copy the code (if the license is amenable to you).

提交回复
热议问题