J
jason
i'm a little new to VC++, so i'm curious how to appropriate perform the
following task.
there is a pointer which i wish you point to a buffer of frequently
changing size. i'm wondering what is the proper way to initially
allocate, and then grow that allocation?
some sample code that might illustrate my intentions:
DWORD CMyClass::MyEvent(void *ptr, char *stufftoappend)
{
if (ptr == NULL)
{
//initial allocation here
ptr = new char[] // like so?
}
//grow the allocation based on the size of stufftoappend here?
}
thanks in advance for any help,
jason
following task.
there is a pointer which i wish you point to a buffer of frequently
changing size. i'm wondering what is the proper way to initially
allocate, and then grow that allocation?
some sample code that might illustrate my intentions:
DWORD CMyClass::MyEvent(void *ptr, char *stufftoappend)
{
if (ptr == NULL)
{
//initial allocation here
ptr = new char[] // like so?
}
//grow the allocation based on the size of stufftoappend here?
}
thanks in advance for any help,
jason