[Gambas-user] load file content in an array

Juan Jose Costello Levien jclevien at ...626...
Fri Jul 8 04:24:34 CEST 2005


Amon,

> is it possible to load the content of a file in an array?
> For each line of that file a new array entry?


You suggest me to think of an array of strings.
The concept of array is of static storage, not dynamic.
If you have always a fixed file size, you know the exact amount of
bytes you need.
But if your file size may vary, then I suggest to use a dynamic
structure, like lists.

Note that a collection type acts like an array, and has an Add()
method to add the lines you want. You can make a collection of strings
of type "Variant" which I suppose can hold variable string size.

Look for "Collection" inside the Gambas help, in "gb" component, class
"Collection".
Or take a look at the Wiki on the Gambas site.

Hope this helps.




-- 
"Einstein was an ignorant. He discovered things which were used to
destroy people.
That proves that even a genius is an ignorant.
So do not be so ignorant and be an investigator and help people wisely. 
At least the little things you know when you die
will have served for joy and happiness for others.
That is your reward. After all, you are ignorant of what is going to
happen when you die."

Juan Jose Costello Levien
jclevien at ...626...




More information about the User mailing list