[DGD]Loading a file into an array

abigail at delanet.com abigail at delanet.com
Mon Jun 19 22:01:25 CEST 2000


On Mon, Jun 19, 2000 at 05:16:27PM +0300, Risto Karjalainen wrote:
> I have this little problem: I should load an over 64kb (which is the maximum
> size for strings in DGD) file into the memory somehow. When trying to read
> the whole file into a string, I just get an error message, "String too long"
> When I try to read the file into an array line by line, I get 
> "Array too large". 

Ah, you got to love those languages with arbitrary limits.

> So, anyone have any ideas (or a working algorithm) to do this?

Well, you could use an array with 64kb chunks. Or else you could use
a linked list, which in be implemented using 2 element arrays; the
first element holds a line, the second points to the rest of the list.
(Or use 3 elements if you want a double linked list).



Abigail

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list