title: How does one use FileStream to append to a file without an exclusive lock?
body: <p>What I'm trying to do with <code>FileStream</code> in C#/.NET is to open two streams: one appending to a file and the other reading those writes asynchronously (for unit testing some network connection handling code).  I can't figure out how to get the <em>writer</em> stream to open the file in non-exlusive locking mode and thus the code always throws an exception:</p>
  
  <blockquote>
    <p>The process cannot access the file
    'C:\test.txt' because it is being used
    by another process.</p>
  </blockquote>
  
  <p>Here's a smattering of code which demonstrates the issue:</p>
  
  <pre><code>FileStream fwriter = new FileStream("C:\\test.txt", FileMode.Append,
      FileAccess.Write, FileShare.Read);
  FileStream freader = new FileStream("C:\\test.txt", FileMode.Open,
      FileAccess.Read, FileShare.Read);
  </code></pre>