title: How can I read from memory just like from a file using wistream?
body: <p>In my <a href="https://stackoverflow.com/questions/4346240/how-can-i-read-from-memory-just-like-from-a-file-using-iostream">previous</a> question I asked how to read from a memory just as from a file. Because my whole file was in memory I wanted to read it similarly.</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/4346240/how-can-i-read-from-memory-just-like-from-a-file-using-iostream/4353718#4353718">answer</a> to my question but actually I need to read lines as a <code>wstring</code>. With file I can do this:</p>
  
  <pre><code>wifstream file;
  wstring line2;
  
  file.open("C:\\Users\\Mariusz\\Desktop\\zasoby.txt");
  if(file.is_open())
  {
      while(file.good())
      {
          getline(file,line2);
          wcout &lt;&lt; line2 &lt;&lt; endl;
      }
  }   
  file.close();
  </code></pre>
  
  <p>Even if the file is in ASCII.</p>
  
  <p>Right now I'm simply changing my <code>string</code> line to <code>wstring</code> with a function from <a href="https://stackoverflow.com/questions/2400383/conversion-from-string-to-wstring-is-causing-u-to-lose-encoding/2400584#2400584">this</a> answer. However, I think if there is a way to treat this chunk of memory just like a <code>wistream</code> it would be a faster solution to get this lines as <code>wstring</code>s. And I need this to be fast.</p>
  
  <p>So anybody know how to treat this chunk of memory as a <code>wistream</code>?</p>