IonicWind Software

IWBasic => General Questions => Topic started by: Brian on February 19, 2010, 12:33:50 PM

Title: Help on Array
Post by: Brian on February 19, 2010, 12:33:50 PM
OK, I think this has been thrown around before . . .

I want to create an ISTRING array of 42 elements, each capable of holding 48 characters

Please, what is the correct way to code this - I always get confused with this one

Thanks,

Brian
Title: Re: Help on Array
Post by: aurelCB on February 19, 2010, 01:10:24 PM
Brian i try with string becose dont work with istring

REM EBASIC example prgram
'IString array
OPENCONSOLE

DEF element:String
'48 characters
element="012345678901234567890123456789012345678912345678"
DEF bigstring[42]:STRING

For n = 0 to 41
bigstring[n]= element
PRINT bigstring[n]
Next n

PRINT "Press Any Key"
DO:UNTIL INKEY$<>""
CLOSECONSOLE
END
i
Title: Re: Help on Array
Post by: aurelCB on February 19, 2010, 01:21:46 PM
Im find that work on this way:

REM EBASIC example prgram
'IString array
OPENCONSOLE

DEF element:String
'48 characters
element="012345678901234567890123456789012345678912345678"
DEF bigstring[42]:ISTRING

For n = 0 to 41
'element=ltrim$(rtrim$(element))
bigstring[n]= element
PRINT bigstring[n],element
Next n

PRINT "Press Any Key"
DO:UNTIL INKEY$<>""
CLOSECONSOLE
END
Title: Re: Help on Array
Post by: LarryMc on February 19, 2010, 02:30:00 PM
Brian

I believe this explanation by Mike Rainey is exactly what you need:  http://www.ionicwind.com/forums/index.php/topic,1650.msg15239.html#msg15239

LarryMc
Title: Re: Help on Array
Post by: Brian on February 20, 2010, 03:14:55 AM
Many thanks, Larry,

I think that is where I was going wrong - assigning the stringth length first,
and then the number of array

aurelcb: Thanks for your help, also - you need to take a look at Larry's link

Thanks again,

Brian