CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: 2kaud

Search: Search took 0.23 seconds.

  1. Replies
    18
    Views
    23,431

    Re: pointer to memory at offset and length

    This is an alternative way of doing it. In this case GetMemory() returns a pointer to new memory of the size specified which contains a copy of the memory pointed to by m_lpData from position offset...
  2. Replies
    18
    Views
    23,431

    Re: pointer to memory at offset and length

    You don't return a 'block of memory'. You return a pointer to a particular memory location which the caller then uses as required.

    Based on your example use, I think this test program shows what...
  3. Replies
    18
    Views
    23,431

    Re: pointer to memory at offset and length

    Sorry but still don't understand.

    Lets say that m_lpdata points to memory location 1000.

    At memory location starting 1000 say the data is

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    ...
  4. Replies
    18
    Views
    23,431

    Re: pointer to memory at offset and length

    If you just want to return a pointer to some part of memory, then all you need is the start and offset - you don't need the length.:confused:
  5. Replies
    18
    Views
    23,431

    Re: pointer to memory at offset and length

    LPVOID m_lpData;

    LPVOID GetMemory(DWORD pos, DWORD length)
    {
    BYTE* buffer = (BYTE*)m_lpData;
    buffer += pos;

    // how to get a length of the memory?

    return ((LPVOID)buffer);
Results 1 to 5 of 5





Click Here to Expand Forum to Full Width

Featured