Problem: Getting buffer data
<p>I'm trying to get my buffer copied into another buffer but I cant get the actual value.</p>

<p>Here is how my program flows:
1. Create random integers
2. Convert it into char
3. Store them into STL container
4. Retrieve first element from the container
5. Convert it into int form</p>

<p>Here is my header file:</p>

<pre><code>struct BufferData
    {
        char *m_BufferData;
        int m_Size;
    };

private:
typedef std::vector&lt;BufferData *&gt;BufferVector;
    BufferVector m_RecvBuffer1, m_RecvBuffer2, m_RecvBuffer3;
    typedef std::vector&lt;BufferData *&gt;::iterator BufferVectorIterator;
    BufferVectorIterator IterBuffer1, IterBuffer2, IterBuffer3;
</code></pre>

<p>And here is my cpp file:</p>

<p>Consider only step #4 and #5.</p>

<pre><code>void CUdpSocket::GetEachBuffer(char *BufferSource1, char *BufferSource2, char *BufferSource3)
{
    if(!m_RecvBuffer1.empty())
    {
        IterBuffer1 = m_RecvBuffer1.begin();
        memcpy(BufferSource1, *IterBuffer1, BUFFER_SIZE);
        m_RecvBuffer1.erase(IterBuffer1);
    }
    else
        memcpy(BufferSource1, 0, BUFFER_SIZE);

    if(!m_RecvBuffer2.empty())
    {
        IterBuffer2 = m_RecvBuffer2.begin();
        memcpy(BufferSource2, *IterBuffer2, BUFFER_SIZE);
        m_RecvBuffer2.erase(IterBuffer2);
    }
    else
        memcpy(BufferSource2, 0, BUFFER_SIZE);

    if(!m_RecvBuffer3.empty())
    {
        IterBuffer3 = m_RecvBuffer3.begin();
        memcpy(BufferSource3, *IterBuffer3, BUFFER_SIZE);
        m_RecvBuffer3.erase(IterBuffer3);
    }
    else
        memcpy(BufferSource3, 0, BUFFER_SIZE);
}
</code></pre>

<p>Here is my output:</p>

<pre><code>m_RecvBuffer1   [1](0x0034feb8 {m_BufferData=0x0034bc28 "45" m_Size=4 })
BufferSource1   0x0034bca8 "(¼4"    char *
</code></pre>

<p>Now as you can see my BufferSource1 become <code>(¼4</code>. It should display 45 in <code>char</code> form instead. How do I fix this? Please help.</p>

<p>Thank you.</p>
