1

If I want to take the text in between two slashes for example:

char str[] = ABCDEFG/HIGKLM/NOPQRS,str[];
While (str[index]!= '\0'){
str1 = TEXT BETWEEN THE SLASHES;
}

So first I want to get "ABCDEFG" into a different array, then "HIGKLM" and finally "NOPQRS"

PIG443
  • 91
  • 5
  • 1
    `strtok` is what your are looking for https://man7.org/linux/man-pages/man3/strtok.3.html – Ôrel Dec 01 '20 at 16:30
  • so search `strtok()` – underscore_d Dec 01 '20 at 16:30
  • 1
    `strtok()` is not a good solution, since it uses `static` variables which can be a problem when you use more than one thread, call some other functions in the meantime that use their own `strtok()` calls or when you write code that may end up in a library. If you use anything that supports POSIX, `strtok_r()` could be a better solution or write your own function, this should not be that hard. – 12431234123412341234123 Dec 01 '20 at 16:53
  • Your code is not valid code. What is `ABCDEFG`? Did you mean `"ABCDEFG"`? Or are this variables or macros? Also what is `While`? Did you mean `while`? – 12431234123412341234123 Dec 01 '20 at 16:55

0 Answers0