title: extracting everything up to a substring is encountered C
body: <p>I was wondering if there is a way I can extract everything before I hit a certain word in a string. The string I have created has been malloced and then populated. I want to create a new string with everything before a certain substring so</p>
  
  <p>String1 = "I need coffee"</p>
  
  <p>how can I extract everything before coffee?</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>