IonicWind Software

IWBasic => General Questions => Topic started by: TexasPete on February 06, 2009, 05:44:19 AM

Title: Making a one dimenstional string array
Post by: TexasPete on February 06, 2009, 05:44:19 AM
I am use to other basics. I disire to make a one dimension array.
in Lb or Power basic something similar would be
dim html$ (100)
would give me an array that is one hundred box deep.

I would move thru the array Like so.
for x = 1 to 100
html(x)
next x

In ebasic I am looking at either the new command or allocamem. I believe this is what is called a pointer method

def html as memory
if alloocmem(html, 100,100)
print "memory allocated"
end

Would the above give me the equivelent of a single dimension array one hundred boxes deep with each box hold one hundred characters of text.

Thanks Texas Pete

Title: Re: Making a one dimenstional string array
Post by: LarryMc on February 06, 2009, 06:02:21 AM
Unless you're going to be changing the size dynamically in your program I would use the following:

def html$[100] as string
I think you will find it much easier for you to use.

The above gives you a 100 element array with each holding a string of default length of 255.

As you have read in the variable section of the help file, arrays in EB are 0 based so the elements would be addressed as
html$[0] through html$[99]

Larry