June 29, 2024, 12:02:40 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Making a one dimenstional string array

Started by TexasPete, February 06, 2009, 05:44:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TexasPete

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


LarryMc

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