title: Memcpy from a char * buffer to a wchar_t * buffer
body: <p>Basically I have</p>
  
  <pre><code>void FileReader::parseBuffer(char * buffer, int length)
  {
    //start by looking for a vrsn
    //Header seek around for a vrns followed by 32 bit size descriptor
    //read 32 bits at a time
    int cursor = 0;
    char vrsn[5] = "vrsn";
    cursor = this-&gt;searchForMarker(cursor, length, vrsn, buffer);
    int32_t size = this-&gt;getObjectSizeForMarker(cursor, length, buffer);
    cursor = cursor + 8; //advance cursor past marker and size
    wchar_t *version = this-&gt;getObjectForSizeAndCursor(size, cursor, buffer);
    cout &lt;&lt; version &lt;&lt; "\n";
    delete[] version;
  }
  
  wchar_t* FileReader::getObjectForSizeAndCursor(int32_t size, int cursor, char *buffer) {
    wchar_t *destination = NULL;
    destination = new wchar_t[(size/2)+1];
    memcpy(destination, buffer + cursor, size);
    return destination;
  }
  </code></pre>
  
  <p>in my example say i have the following bytes</p>
  
  <p>7672736E - marker vrsn</p>
  
  <p>00000040 - size of string to follow</p>
  
  <p>0032002E0030002F00530065007200610074006F002000530063007200610074006300680020004C004900560045002000440061007400610062006100730065 - string</p>
  
  <p>the string uses 16 bytes per character, so i cannot use a char * for the actual string, wchar_t seems like the best bet.</p>
  
  <p>However when i memcpy these bytes to a wchar_t i get 0x7fe7abc037e0 in cout which i assume is a pointer?</p>
  
  <p>which seems wrong. when i use wcout i get nothing in the terminal.</p>
  
  <p>Will memcpy not work for this?</p>
  
  <p>also should my wchar_t size be halved since i only have half as many wchar_t's as i would have chars?</p>
  
  <p>size is a byte count.</p>