I am fairly new to C++/CX programming, please correct the question for any mistakes.
I am trying to create a Public API in Windows Runtime using C++/CX, where I have to define a method which has two dimensional byte array as out parameter. I think, I cannot use Array<byte>^ for this purpose as it is suppose to be a one dimensional array. But Visual Studio complier suggests me to have declaration like below
void getByteArrays(int *size, Array<byte>^* arr);
- But I cannot initialize arrin the implementation, I think the reason is same,Arraycan be only one dimensional array?
But I can still send Array<byte>^ though using below initialization.
byte *buffer = /* Something */ ;
arr[0] = ref new Array<byte>(buffer, size);
- Is this approach correct?
- If not, what is the best way to have a two dimensional bytearray as out parameter usingPlatform namespaceonly?
Below is my complete code
void getByteArrays(int *size, Array<byte>^* arr)
{
    byte *buffer = /* Something */;
    (*size) = /* Something */;
    arr = ref new Array<byte>(2); //How do i tell compiler that it has 2 rows?
    arr[0] = ref new Array<byte>(buffer, (*size));
    arr[1] = ref new Array<byte>(buffer, (*size));
}
Update : I think, complier was suggesting to pass the Array<byte>^ pointer as reference for out parameter. So, it is still be a one-dimensional array.
