|
-
June 26th, 2002, 07:45 AM
#1
Buffer
I have a Cyclic Buffer into which I have to put objects. Iam allocating bytes for the object first & then Putting the object into this memory later.
allocating bytes is done this way
char* allocateBytes(unsigned int num)
{
if(num <= bufersize())
{
char* pAllocated = m_pwrite;
m_pwrite += num;
//Write ptr of Buffer
return pAllocated;
}
I have a pointer to the beginning of the object(The write ptr),whenever a new object is placed in the buffer.At some point,the buffer reaches its end & the memory which Iam allocating for this object will be split between the end of the buffer & the beginning of the buffer.So the pointer to this object will be at the end of the buffer ,with some memory for this object allocated at the beginning of the buffer.
My question is ,if I use this ptr, would I able to acces the object(whose memory is split between the end & beginning of buffer)
If Not what Should I do?
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|