View Full Version : Constant array of string

Bill Drummond
03-17-2009, 06:47 AM
With Pascal I can do:
·commands : array[0..3] of string[3] = ('dir','del','cpy','typ' );

how is it done with spin?

Mike Green
03-17-2009, 07:34 AM
You'd use a DAT block like:

commands byte "dir",0, "del",0, "cpy",0, "typ",0

To access these, you'd use a subscript that's a multiple of 4 like @command[ 0 ] or @command[ 12 ]. These would give you the address of the string(s). If you want to access individual characters, you could just use command[ x ] where x is between 0 and 15.

Bill Drummond
03-17-2009, 07:53 AM
Thanks mike, that makes sense and it works too.