okay..

a string is made of an array of bytes
how would i...

create an array of strings
and index them properly? i'm confused here because for instance if i did

stringarray db 4 dup("TEST",0,"TEST1",0,"TEST02",0,"TEST003",0,"TEST04",0,TEST0005",0)

i cant see a way to index them fluently, as with a loop or sort

it has to be like:



lea esi,stringarray
lea eax, [esi] ;; load address of "TEST" in eax
lea eax, [esi+5+6] ;; load address of "TEST" in eax
lea eax, [esi+5+7+7] ;; load address of "TEST" in eax
;;..and so on


i know maybe my code example aight right, but u know what i mean, how would i do it like this


lea esi,stringarray
mov ecx,1
@@:
mov address[ecx],[esi*ecx+4]
inc ecx
cmp ecx,dwArraySize
jl @B


like in visual basics, you would create a string array and.. access it like
mystring[10] = "my string at index 10"

its confusing, cause its a byte array!

would i make a multidimensional array?
ie,
array: dword x 256 bytes
[0]
[1]
[2]

how would i declare that properly?
Posted on 2003-04-05 05:11:00 by xkardisx
String arrays in the conventional sense are just an array of pointers to the strings.

[size=12]string1 db "Hello",0

string2 db "World", 0
stringarray dd offset string1, offset string2[/size]


And to access it:

[size=12]mov eax, stringarray

mov ecx, index
lea eax, [eax+ecx*4][/size]
Posted on 2003-04-05 05:46:00 by iblis
0mg that was easy!! thanks!!

i was just making it too complicated. that really simplified things. made it clear. i dont know how i missed it. :x

thanks again!!
Posted on 2003-04-05 05:52:05 by xkardisx