title: malloc pointer function passing fread
body: <p>Can't figure out what's wrong, I don't seem to be getting anything from fread.</p>
  
  <h2>port.h</h2>
  
  <pre><code>#pragma once
  #ifndef _PORT_
      #define _PORT_
      #include &lt;string&gt;
      #ifndef UNICODE
          typedef char chr;
          typedef string str;
      #else
          typedef wchar_t chr;
          typedef std::wstring str;
          inline void fopen(FILE ** ptrFile, const wchar_t * _Filename,const wchar_t * _Mode)
          {
              _wfopen_s(ptrFile,_Filename,_Mode);
          }
      #endif
  #endif
  </code></pre>
  
  <h2>inside main()</h2>
  
  <pre><code>    File * f = new File(fname,FileOpenMode::Read);
      chr *buffer;
      buffer = (wchar_t*)malloc(f-&gt;_length*2);
      for(int i=0;i&lt;f-&gt;_length;i++)
      {
        buffer[i] = 0;
      }
      f-&gt;Read_Whole_File(buffer);
      f-&gt;Close();
      for(int i=0;i&lt;f-&gt;_length;i++)
      {
        printf("%S",buffer[i]);
      }
      free(buffer);
  </code></pre>
  
  <h2>inside file class</h2>
  
  <pre><code>    void Read_Whole_File(chr *&amp;buffer)
      {
          //buffer = (char*)malloc(_length);
          if(buffer == NULL)
          {
              _IsError = true;
              return;
          }
          fseek(_file_pointer, 0, SEEK_SET);
          int a = sizeof(chr);
          fread(&amp;buffer,_length ,sizeof(chr) , _file_pointer);            
      }
  </code></pre>