title: C - Cut a string after last "/" in string
body: <p>Is is somehow possible to cut of a string after the last time the specific character "/" comes up in the string?
  For example:
  /one/two/three/four would be cut into /one/two/three</p>
  
  <p>I have tried something like this in a loop to chop it into multiple pieces:</p>
  
  <pre><code>substr = strstr(line, "/");
  nextSubstr= substr+1; 
  length = strlen(line) - strlen(substr);
  substr = strndup(line, length);
  </code></pre>
  
  <p>but I feel like it should be a more effective way to do this.. Thanks for any help</p>