N
ned
I have been having a lot of problems with an array of structures
embedded in another structure in C++ .NET and have boiled it down to
this very simple example:
Try the following steps, it will only take 5 minutes:
1) Create a new C++ .NET Windows Form project.
2) Create a new .h file and put in it:
typedef struct _mini
{
int iVal;
} miniStruct;
typedef struct _test
{
miniStruct mini[10];
} testStruct;
3) In the form1.h file, include the .h file you just created.
4) In the form1.h file Form_Load procedure:
testStruct test;
test.mini[0].iVal = 11;
test.mini[1].iVal = 22;
Please tell me why test.mini[1].iVal does not get set to 22. It is
always 0.
Does this have anything to do with the structures being an unmanaged
(native) C++? I am just learning about managed code and .NET, coming
from a Visual C++ world. I am trying currently to make the structs
above managed structs but having a lot of trouble trying to figure out
how to do an embedded array of structures in another structure using
the managed extensions.
Any help you can give would be greatly appreciated.
thank you.
embedded in another structure in C++ .NET and have boiled it down to
this very simple example:
Try the following steps, it will only take 5 minutes:
1) Create a new C++ .NET Windows Form project.
2) Create a new .h file and put in it:
typedef struct _mini
{
int iVal;
} miniStruct;
typedef struct _test
{
miniStruct mini[10];
} testStruct;
3) In the form1.h file, include the .h file you just created.
4) In the form1.h file Form_Load procedure:
testStruct test;
test.mini[0].iVal = 11;
test.mini[1].iVal = 22;
Please tell me why test.mini[1].iVal does not get set to 22. It is
always 0.
Does this have anything to do with the structures being an unmanaged
(native) C++? I am just learning about managed code and .NET, coming
from a Visual C++ world. I am trying currently to make the structs
above managed structs but having a lot of trouble trying to figure out
how to do an embedded array of structures in another structure using
the managed extensions.
Any help you can give would be greatly appreciated.
thank you.