title: Read memory mapped file to string
body: <p>I am trying to read data from a memory mapped file, which is written to the memory file from a C++ program. I am able to use the debug method and write the data as a string from a loop. However, I want to convert the byte array to a usable string that I can then manipulate.</p>
  
  <pre><code>using (MemoryMappedFile mmf = MemoryMappedFile.OpenExisting("DataFile"))
  {
      using (MemoryMappedViewAccessor reader = mmf.CreateViewAccessor())
      {
          var bytes = new byte[reader.Capacity];
          reader.ReadArray&lt;byte&gt;(0, bytes, 0, bytes.Length);
          for(int i = 0; i&lt;bytes.Length; i++)
          {
              System.Diagnostics.Debug.Write((char) bytes[i]);
          }
      }
  }
  </code></pre>
  
  <p>I've tried removing the for loop and replacing it with a GetString() encoder, but it only returns a question mark character instead of the full data string.</p>