HP-UX C SIP Stack Programmer's Guide (Novembery 2007)
Memory Pool 361
Using the Memory Pool
Sample Code
/*=========================================================================================*/
RvStatus CopyBuffersWithPage(IN HRPOOL memoryPool,
IN HPAGE memoryPage)
{
RvStatus retStatus;
RvInt32 offset, size;
RvChar source[50], dest[50];
/*Sets the source buffer.*/
strcpy(source,"Hello, How are you?");
size = strlen(source)+1;
/*Copies the source buffer to the page.*/
retStatus = RPOOL_AppendFromExternalToPage memoryPool,memoryPage, source, size,& offset)
if(retStatus != RV_OK) return RV_ERROR_UNKNOWN;
printf("%s - was added to the page at offset %d\n",source,offset);
/*Copies information from the page to the destination buffer.*/
retStatus = RPOOL_CopyToExternal(memoryPool,memoryPage,offset, dest,size);
if(retStatus != RV_OK) return RV_ERROR_UNKNOWN;
printf("the dest buffer contains - %s\n",dest);
return RV_OK;
}
/*=========================================================================================*/