Page 1 of 1

Updating the size of an array

Posted: Mon Sep 22, 2014 9:55 pm
by Massage_Dude
I am wanting to save a list of peoples names into a file!
Initially, the list is small but I want my program to add names to my list.
My difficulty is that I want my People$() array to increase in size as names are added!

This so my program can allocate People$(# according to list in file at start up!)
Understand what I don't understand? I could use some help.

Some example code might be helpful.
Thanks

Re: Updating the size of an array

Posted: Tue Sep 23, 2014 2:16 am
by Mr. Kibernetik
You cannot increase size of your array and keep its old values intact.
If you create array of bigger size, it is re-initialized.

So you have to create your own algorithm of adding new values to your array.
There can be many different approaches, for example use intermediate array to keep old values before you increase size of your array.

Re: Updating the size of an array

Posted: Tue Sep 23, 2014 8:31 am
by Massage_Dude
Thank you for your quick response.
I have some ideas I think may work.

I'll update this post after my idea is tried and hopefully succeeds!

- I value your time! Thanks

Re: Updating the size of an array

Posted: Tue Sep 23, 2014 10:32 am
by Henko
You might have a look into the program "password manager" in this program section.
There an extensible array of strings is used to fully fit in a UI list. With "add" and "delete" functions