Search code examples
cstrstr

Search a string with strstr in a part of an char *


currently I search a char * with strstr but I dont want to search in the complete one, only from the 42. char to the end. How can I achieve this?


Solution

  • Add 42 to the original str pointer (beware that original string length is greater than 42 though):

    first_occurence = strstr(str + 42, substr);