I am trying to utilise a development kit for software that we use at work.
I think I have found a member function that would address a problem I have and I'm trying to test it.
The documentation says that it is used thus:
int
SDKclass::SDKclassmethod(
a_data_type** a_data_array_ptr,
char*** b_array_ptr,
int& num,
c_data_type c_data_inst)
My problem is that I cannot understand the usage of the 2nd input b_array_ptr. I believe it is a pointer to an array of char arrays. This would be a logical format for the variable. However, I cannot find a way of initialising it that my compiler (MSVS2008) is happy with.
I have tried just declaring it but not initialising it:
a_data_type *a_data_array, **a_data_array_ptr;
char*** b_array_ptr;
int numFtrs;
//code where a value is given to numFtrs - I know this works fine
a_data_array = new a_data_type[numFtrs];
a_data_array_ptr = &a_data_array;
//
mySDKclass->SDKclassmethod(a_data_array_ptr, b_array_ptr, num, c_data_inst);
but then I get a memory error at run time at the final line in the above code and my assumption is that this is because the function doesn't have initialised memory to write to. Is this a reasonable assumption? I am not entirely confident about my intialisation of a_data_array_ptr
but the compiler at least seems happy with this.
I can say what the length of both arrays are. I have tried various combinations of [] and * e.g.:
#define MAXPATHLEN 1024;
int numFtrs;
char b_array[][], ***b_array_ptr;
//code where a value is given to numFtrs - I know this works fine
b_array = new char[MAXPATHLEN][numFtrs];
b_array_ptr = &b_array;
But I get various messages about not being able to convert from char[] to char* and also not being able to set array bounds with non-constants. All of these I understand but it leaves me flummoxed as to how I initialise this char*** variable. Somehow I need to be able to set the sizes of the two arrays.
Please can somebody suggest a solution? If I send a question the software vendor its usually several months before I get some sort of answer.