title: What is this ? in the beginning of the console output after reading a text file encoded with Unicode?
body: <p>I've been tinkering with reading files(text files encoded in Unicode) and for some reason I get a question mark in the beginning of the output.</p>
  
  <p>Here's the code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  #include &lt;Windows.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;io.h&gt;
  
  int main(void)
  {
      HANDLE hFile = CreateFile(L"dog.txt",
                                GENERIC_READ,
                                NULL,
                                NULL,
                                OPEN_EXISTING,
                                FILE_ATTRIBUTE_NORMAL,
                                NULL);
  
      _setmode(_fileno(stdout), _O_U16TEXT); //Making sure the console will 
                                             //display the  wide characters 
                                             //correctly. See below for link
  
      LARGE_INTEGER li;
      GetFileSizeEx(hFile,&amp;li); 
  
      WCHAR* pBuf = new WCHAR[li.QuadPart / sizeof(WCHAR)]; //Allocating space for 
                                                            //the file.
  
      DWORD dwRead = 0;
      BOOL bFinishRead = FALSE;
      do
      {
          bFinishRead = ReadFile(hFile,pBuf,li.QuadPart,&amp;dwRead,NULL);
      } while(!bFinishRead);
  
      pBuf[li.QuadPart / sizeof(WCHAR)] = 0; //Making sure the end of the output 
                                             //is null-terminated.
  
      std::wcout &lt;&lt; pBuf &lt;&lt; std::endl;
  
      std::cin.get();
  
      return 1;
  }
  </code></pre>
  
  <p>dog.txt</p>
  
  <pre><code>One Two Three
  </code></pre>
  
  <p>Console output</p>
  
  <pre><code>?One Two Three
  </code></pre>
  
  <p>I already eliminated a lot of gibberish by making sure the end of the output is null-terminated but the ? in the beginning puzzles me.</p>
  
  <p>As for the </p>
  
  <pre><code>_setmode(_fileno(stdout), _O_U16TEXT);
  </code></pre>
  
  <p>see <a href="https://stackoverflow.com/questions/2492077/output-unicode-strings-in-windows-console-app">Output unicode strings in Windows console app</a></p>
  
  <p><strong>Note:</strong> My code is Windows-oriented and I intend to keep it that way if possible.</p>
  
  <p>Thanks.</p>