title: Convert "\\n" to a newline character
body: <p>I'm parsing a stream one character at a time, as in the highly simplified example below. My problem is that I need to translate the <code>\\n</code> to an actual newline character (and similarly for any other escaped characters).</p>
  
  <p>Is there a better way than the manual way I've done it here? Because that becomes rather cumbersome if I have to convert every possible escape character that way.</p>
  
  <pre><code>char c ;
  std::stringstream s("foo \\n bar") ;
  
  while (s.good()) {
      c = s.get() ;
      if (!s.good()) break ;
      if (c == '\\' &amp;&amp; s.get() == 'n') c = '\n' ;
      std::cout &lt;&lt; c ;
  }
  </code></pre>