Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

Posted

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.)

  • *Experts*
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...