I need to get a pointer to a particular spot in an array - it's an __int64 array. So I googled around and this seems to be what I need to do - please tell me if I'm missing something or doing something wrong.
The array I need a pointer to is passed into this C++ function as cwlayout
Code:
int processCW(WCHAR *strSearch, int *smarkerskt, int *emarkerskt..., __int64 *cwlayout...) {
Comes from VB as Dim cwLayout(cwValue - 1) As Long - but that doesn't really matter...
Back in the C++ I've got this class that I've added cwPointerLayout to - declaring it to be a "pointer to" an "__int64" memory spot (I think I've done that!). I've also initialized the pointer to nullptr - that made it look good while stepping through the code in the debugger...
Code:
class cwObject {
public:
WCHAR cwR;
.
.
.
__int64 * cwPointerLayout;
int dbgS;
int dbgE;
bool dbgStarted;
cwObject () {cwRun = 0...
cwPointerLayout = nullptr;
dbgOn = false, dbgStarted = false;
dbgS = -1, dbgE = -1;
cwR = L'', cwRXOff = L'';
};
};
Back in the function I do this
Code:
cwlayout[loopCW] = 0; // Clear the layout
cwX.cwPointerLayout = & cwlayout[loopCW]; // Get a pointer to that spot
And that seems to load the address of the [loopCW] spot of the array into the cwPointerLayout variable.
And in the immediate window I did this
Code:
*cwX.cwPointerLayout = 123
And that seemed to change the value of cwlayout[loopCW].
Is that the way this is supposed to be setup? Am I using the referencing and dereferencing properly?
Thanks!