G
Guest
I am having this problem in a managed c++ DLL which mixes managed and
unmanaged C/C++ code. I tried to assign value to a struct array nested in
another struct. but I can only write to the first element in array, not the
others.
struct struct2{
int a;
int b;
};
struct struct1 //struct with nested struct2 array
{
struct2 item [10];
} ;
void ComboTest(){
struct1 trans;
//nested struct array. nope.
trans.item[0].a = 1; //assign for item[0] is fine
trans.item[0].b = 10; //assign for item[0] is fine
trans.item[1].a = 2; //assign for item[1] does not work.
trans.item[1].b = 20; //assign for item[1] does not work.
//print out trans.
}
there is no compilation or runtime error. but after the assignment the value
of item[1] just stays unchanged (at default 0s). Is it because nested struct
array is not supported in managed c++? Could anyone shed some light on how to
work around? thanks!
unmanaged C/C++ code. I tried to assign value to a struct array nested in
another struct. but I can only write to the first element in array, not the
others.
struct struct2{
int a;
int b;
};
struct struct1 //struct with nested struct2 array
{
struct2 item [10];
} ;
void ComboTest(){
struct1 trans;
//nested struct array. nope.
trans.item[0].a = 1; //assign for item[0] is fine
trans.item[0].b = 10; //assign for item[0] is fine
trans.item[1].a = 2; //assign for item[1] does not work.
trans.item[1].b = 20; //assign for item[1] does not work.
//print out trans.
}
there is no compilation or runtime error. but after the assignment the value
of item[1] just stays unchanged (at default 0s). Is it because nested struct
array is not supported in managed c++? Could anyone shed some light on how to
work around? thanks!