title: Adding new line terminator to the end of every line
body: <p>What is the best way to add a '\r' to my new-line sequence? I am writing a string to a file and doing various parsing to it but according to my assignment spec a new line will be considered '\r\n'. </p>
  
  <p>Right now I only have a new line at the end. I was thinking of a for loop and/or using memmove but not sure exactly how to make it work?</p>
  
  <pre><code>for (int x = 0;x &lt; strlen(string);x++)
  {
      if (string[x] == '\n')
      {
          ..............
      }
  }
  </code></pre>