Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

realloc

Status
Not open for further replies.

revit

Programmer
Oct 27, 2001
36
IL
I have an array that i allocated (using new operator) and i need an option to reallocate it if the actual size is bigger then i originally alocated it.
what operator should i use? (i know there is realloc in c)
thanks in advance
 


void* myRealloc(void* ptr,int newSize, int oldSize)
{
char* temp;
temp = new char[newSize];
memcpy(temp,ptr,oldSize);
delete[] ptr;
ptr = temp;
return temp;
}

that should do it
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top