Hi,
BACKGROUND
I am creating a simple application.
It an Excel file which connects to a C++ DLL.
I am building the C++ DLL in Bloodshed Dev-C++.
I can connect an Excel file to the DLL successfully.
PROBLEM
The problem I have is a assigning a value to an array in the C++ code.
The excel passes a Variant ByRef which is a 2D Array (23 x 23)
as it passes the Variant it passes address information as well making the Variant passed in 23x46.
So I try to use the Pointer Array (Varinat passed in) to strip the data I want into another array (23x23)
The line that crashes the DLL is Billday2[xx] = tempVal;
Hence it cannot assign a value to the array.
If I comment out this line the code works fine and prints a txt file with all the data I want.
Can somebody help. ??
BACKGROUND
I am creating a simple application.
It an Excel file which connects to a C++ DLL.
I am building the C++ DLL in Bloodshed Dev-C++.
I can connect an Excel file to the DLL successfully.
PROBLEM
The problem I have is a assigning a value to an array in the C++ code.
The excel passes a Variant ByRef which is a 2D Array (23 x 23)
as it passes the Variant it passes address information as well making the Variant passed in 23x46.
So I try to use the Pointer Array (Varinat passed in) to strip the data I want into another array (23x23)
Code:
const int nNumRows = 23;
const int nNumCols = 23;
double Billday2[nNumRows][nNumCols] = { 0 };
double tempVal;
for (int j = 0; j<48; j++)
{
j++;
int xx;
if (j==1)
{ xx = j; }
else
{ xx = (j-1)/2; }
for (int i = 0; i<24; i++)
{
tempVal = new double Billday[i][j];
myfile << tempVal << ", ";
Billday2[i][xx] = tempVal;
myfile << i << "x" << xx << ", ";
}
myfile << "\n";
}
The line that crashes the DLL is Billday2[xx] = tempVal;
Hence it cannot assign a value to the array.
If I comment out this line the code works fine and prints a txt file with all the data I want.
Can somebody help. ??