Hi,
I am getting this error message A2070: invalid instruction operands
foo Struct
vName byte 10 dup (?)
Value byte 50 dup (?)
foo Ends
Main Proc
local info[5]:Foo
mov eax,K Index of field
mov ecx,SIZEOF Foo
mul ecx
mov info[eax].vName,offset Tmp <==On this line I get error A2070: invalid instruction operands
What am missing or doing wrong.
Thanks
you need to give it a size, eg:
mov dword ptr info[eax].vName,offset Tmp
however, from the definition in foo, I'm not sure what you wanted to store here, certainly not 10 bytes.
If you wanted to get the actual string from the buffer Tmp into the 10 byte buffer vName, then you have to do a copy of some kind.
well, if you have to do this then your struct design is wrong
mov info[eax].vName,offset Tmp
should really be...
foo Struct
vName LPVOID ?
Value byte 50 dup (?)
foo Ends
and you'd access it like...
mov info.foo.Value, offset Tmp
which should compile quite fine
that way if you change the struct, like adding more to it, or restructuring it it wont break...
really you should design the struct for the purpose you intend to use it for...