title: Re-casting array to store inside a vector
body: <p>I'm having a weird problem. I have an array which I need to return to another function. The problem is that it has to be outputted/converted as a </p>
  
  <pre><code>(unsigned)(unsigned char)
  </code></pre>
  
  <p>The function which handles the data is a char* type. Here is the function in which I am converting the data:</p>
  
  <pre><code>char* Wav::readHeader(ifstream &amp;file)
  {
  file.read(this-&gt;chunkId,                                 4);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;chunkSize),     4);
  file.read(this-&gt;format,                                  4);
  
  file.read(this-&gt;formatId,                                4);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;formatSize),    4);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;format2),       2);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;numChannels),   2);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;sampleRate),    4);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;byteRate),      4);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;align),         2);
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;bitsPerSample), 4);
  
  char testing[4] = {0};
  int testingSize = 0;
  
  while(file.read(testing, 4) &amp;&amp; (testing[0] != 'd' ||
                                  testing[1] != 'a' ||
                                  testing[2] != 't' ||
                                  testing[3] != 'a'))
  {
  
      file.read(reinterpret_cast&lt;char*&gt;(&amp;testingSize), 4);
      file.seekg(testingSize, std::ios_base::cur);
  
  }
  
  this-&gt;dataId[0] = testing[0];
  this-&gt;dataId[1] = testing[1];
  this-&gt;dataId[2] = testing[2];
  this-&gt;dataId[3] = testing[3];
  
  
  
  file.read(reinterpret_cast&lt;char*&gt;(&amp;this-&gt;dataSize),     4);
  
  this-&gt;data = new char[this-&gt;dataSize];
  
  file.read(data,                           this-&gt;dataSize);
  
  for(unsigned i=0; (i &lt; 20); i++)
  {
      //cout &lt;&lt; (unsigned)(unsigned char)data[i] &lt;&lt; endl; 
  
  }
  
  return (unsigned)(unsigned char) data;
  }
  </code></pre>
  
  <p>And in another function, I have this:</p>
  
  <pre><code>unsigned char* data = this-&gt;readHeader(file);
  </code></pre>
  
  <p>Can anyone see where I'm going wrong?</p>
  
  <p>Thank you :)</p>