title: How to detect carriage return in C?
body: <p>For my homework we are supposed to write a checksum that continues to display checksums until a carriage return is detected (Enter key is pressed). My checksum works fine and continues to prompt me for a string to convert it to a checksum, but my program is supposed to end after I press the enter key. In my code, I set up a while loop that continues to calculate the checksums. In particular I put: </p>
  
  <pre><code>while(gets(s) != "\r\n")
  </code></pre>
  
  <p>Where s in a string that the user has to input. I've also tried this with scanf, and my loop looked like:</p>
  
  <pre><code>while(scanf("%s",s) != '\n')
  </code></pre>
  
  <p>That did not work as well. Could anyone please give me some insight onto how to get this to work? Thanks</p>