title: How to interpret special characters in command line argument in C?
body: <p>First problem:</p>
  
  <p>Suppose we write a simple program which takes in command line arguments and prints to a file. If the user enters</p>
  
  <blockquote>
    <p>writetofile Hello!0\n w%orl\t!@#y</p>
  </blockquote>
  
  <p>bash replies with</p>
  
  <blockquote>
    <p>!0: event not
    found.</p>
  </blockquote>
  
  <p>Without the user knowing things like using quotes ('') or escape characters ('\'), how do I handle this stuff instead of bash understanding it as a command?</p>
  
  <p>Second problem:</p>
  
  <p>Once I get these arguments, how do I interpret them as special characters and not sequences of characters. (ie. \t is tab, not '\''t')</p>
  
  <p>That is, how do make sure that the program writes this to the file:</p>
  
  <pre><code>Hello!0
   w%orl    !@#y
  </code></pre>
  
  <p>and not</p>
  
  <pre><code>Hello!0\n w%orl\t!@#y
  </code></pre>