fork(1) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. char *test = "m111 foo bar11";
  6. char comtodo[][12] = {
  7. "m11"
  8. };
  9.  
  10. char *istr = strstr(test, comtodo[0]);
  11. int len = strlen(comtodo[0]);
  12.  
  13. printf("Len is: %d\n", len);
  14. printf("pointer: %s\n", istr);
  15.  
  16. if (istr != NULL) {
  17. printf ("Found at %d\n",istr-test+1);
  18. } else {
  19. printf ("Not found\n");
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4432KB
stdin
Standard input is empty
stdout
Len is: 3
pointer: m111 foo bar11
Found at 1