Posts: 3
Threads: 2
Joined: Jan 2012
1.How to i can populate a binary array or string with multiple values more easiest way?
ARRAY(byte) a
a[]=0x1C;a[]=0x2C;a[]=0x3C;a[]=0x4C;a[]=0x5C;a[]=0x6C;a[]=0x7C;a[]=0x8C;
etc.
2.Explain me please, how used suffix letter U (unsigned int) to change current type of int?
Thanks
Posts: 12,061
Threads: 140
Joined: Dec 2002
Macro
Macro1599
;this can be use to create string of constant byte values
lpstr s="[0x1C][0x2C][0x3C][0x4C][0x5C][0x6C][0x7C][0x8C]"
;this can be used to create ARRAY(byte) from string
ARRAY(byte) a.create(8)
memcpy &a[0] s a.len
;results
int i
for(i 0 a.len) out "0x%X" a[i]
;or
outb &a[0] a.len
other way
Macro
Macro1600
str s="1C 2C 3C 4C 5C 6C 7C 8C"
s.decrypt(8)
;results
outb s s.len 1
------------------------
unsigned int
Macro
Macro1598
out -1
out -1U
int i=-1
out i
out i+0U
out ConvertSignedUnsigned(i)
Posts: 3
Threads: 2
Joined: Jan 2012
Can I put int value into a string of bytes, may be through the point?
Something like this:
str s="-test-"
int i=0x54534554
s[1]=i
out s
Posts: 12,061
Threads: 140
Joined: Dec 2002
yes, through pointer
Macro
Macro1634
str s="-test-"
int i=0x54534554
int* p=s+1; p[0]=i
out s
or memcpy
Macro
Macro1635
str s="-testtest-"
int i0(0x54534554) i1(0x54534554)
memcpy s+1 &i0 8
out s