October 31, 2025, 07:50:02 AM

News:

IWBasic runs in Windows 11!


Help on Array

Started by Brian, February 19, 2010, 12:33:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

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

aurelCB

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

aurelCB

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

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