title: What is a good way of looping through lines in a multi-line string?
body: <p>My function <code>foo(char *str)</code> receives <code>str</code> that is a multiline string with new line characters that is null-terminated. I am trying to write a while loop that iterates through the string and operates on one line. What is a good way of achieving this?</p>
  
  <pre><code>void foo(char *str) {
      while((line=getLine(str)) != NULL) {
          // Process a line
      }
  }
  </code></pre>
  
  <p>Do I need to implement <code>getLine</code> myself or is there an in-built function to do this for me?</p>