title: C++: Reading data from a memory mapped file
body: <p>I have used MapVirtualFile to map a file under Window using C++ VS2010.
  The void is </p>
  
  <pre><code>  void*                   m_pVoiceData;
  </code></pre>
  
  <p>I would now like to fill a structure with the data.</p>
  
  <p>I have been using</p>
  
  <pre><code>void clsMapping::FeedPitchmarksFromMap(udtPitchmarks &amp;uAudioInfo,unsigned long int uBytePos)
  {
  
      unsigned long int iCountPM;
      memcpy(&amp;iCountPM, &amp;((char*)(m_pVoiceData))[uBytePos],sizeof(int));
  
      uAudioInfo.Pitchmarks.resize(iCountPM);
  
      for (unsigned long int i=0;i&lt;iCountPM;i++)
      {
          iBytePos+=sizeof(int);
          unsigned long int iByteStart;
          memcpy(&amp;iByteStart, &amp;((char*)(m_pVoiceData))[iBytePos],4);
  
          iBytePos+=sizeof(int);
          unsigned long int iByteCount;
          memcpy(&amp;iByteCount, &amp;((char*)(m_pVoiceData))[iBytePos],4);
  
          iBytePos+=sizeof(int);
          unsigned int iF0;
          memcpy(&amp;iF0, &amp;((char*)(m_pVoiceData))[iBytePos],4);
  
          uAudioInfo.Pitchmarks[i].ByteStart =iByteStart;
          uAudioInfo.Pitchmarks[i].ByteCount =iByteCount;
          uAudioInfo.Pitchmarks[i].F0 =iF0;
      }
  }
  </code></pre>
  
  <p>As one can see, I am currently using memcpy to get the data. 
  Is there a faster way to do "get my data over"?</p>