I cannot use strstr, memchr because array can contains any number of \0 chars, is there are any efficient ways to do that? I have to find all positions (indexes) or pointers.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Piece of cake in C++:
Another option is to use a generic algorithm:
Bear in mind that C++
stringobjects can contain arbitrary data. To create a string from a byte buffer, pass its size to the constructor: