Consider why you must convert to C. I cont see many reasons where C would be necessary over C++.
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
It's not all that difficult to do. Here's an example of push_back
const int BlockSize = 10; // allocate this number of elements at one time
int MaxArraySize = 0; // initial size of the array
int CurrentSize = 0; // current number of elements used in the array
char** array = 0;
void ReallocArray()
{
MaxArraySize += BlockSize;
array = realloc(array,MaxArraySize);
}
char* push_back(const char* item)
{
if( (CurrentSize+1) >= MaxArraySize )
{
ReallocArray();
}
array[CurrentSize] = malloc(strlen(item)+1);
strcpy(array[CurrentSie], item);
++CurrentSize;
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343