title: How to print out a backslash in LaTeX
body: <p>I want to write a backslash character to a text file using LaTeX.</p>
  
  <p>The first line of code below declares a variable 'file' which describes the file 'myfile.out'. The second line opens the file and the third one tries do write a backslash '\' to the file.</p>
  
  <pre><code>\documentclass{article}
  \begin{document}
     \newwrite\file%
     \immediate\openout\file=myfile.out%
     \immediate\write\file{\}%
  \end{document}
  </code></pre>
  
  <p>The third line does not work because LaTeX get confused with the backslash, anyone knows how can I make it work? I tried a lot of things including <code>\textbackslash, $\backslash$ \char</code> ``\`  etc and nothing seems to work.</p>
  
  <p>Thanks a lot</p>