title: win32 api reading file
body: <p>I'm trying to read a file using WIN32 api but when I try to print one character it is completely gibberish
  I tried to change the file encoding : unicode,ansi,utf-8 but the problem persist</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main(){
  
  TCHAR buff[512];
  DWORD wr,pos;
  DWORD bytesWritten;
  DWORD len = (DWORD)strlen(buff);
  
  
   HANDLE f = CreateFile("test.txt",GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
  
   if(f==INVALID_HANDLE_VALUE)
   {
      cout&lt;"error";
   }
  
  
  
   ReadFile(f, buff ,len,&amp;wr, NULL);
  
   cout&lt;&lt;buff[0];
  
  
  
  
   CloseHandle(f);
  
   return 0;
  }
  </code></pre>