meretrix Posted August 16, 2003 Posted August 16, 2003 test = new Byte[1600]; for (int i=0; i<40; i++) for (int j=0; j<40; j++) test->SetValue(0x0A, (j*40)+i); gives the error: "void System::Array::SetValue(System::Object __gc*, int): cannot convert parameter 1 from 'int' into 'System::Object __gc*' " How do you set the values of an array? Quote
Administrators PlausiblyDamp Posted August 17, 2003 Administrators Posted August 17, 2003 Is this in managed C++? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
meretrix Posted August 17, 2003 Author Posted August 17, 2003 Now it spits a new error at me... '[' : Cannot perform pointer arithmetic on __gc pointer 'System::Array __gc*' (That's what I tried to begin with, by the way... I've done plenty of C programming, but this managed C++ stuff is totally new to me.) Quote
*Experts* Volte Posted August 17, 2003 *Experts* Posted August 17, 2003 You need to box the object into a managed object.test->SetValue(__box(0x0A), (j*40)+i);You may need to do it more like this.int val = 0x0A; test->SetValue(__box(val), (j*40)+i);Since I'm not sure if __box will work on straight values rather than variables or objects. Quote
meretrix Posted August 17, 2003 Author Posted August 17, 2003 Perfect! I had to do "unsigned char val=0x0A" instead of "int," but it works now. Thanks a lot! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.