Re: Read a list with undefined length



Arjan <arjan.van.dijk@xxxxxxx> wrote:
(snip, and previous snip, regarding "err, end, eor")

I have a plotting utility that uses "END=" to detect when its task has
finished. Data are not stored, but each point is processed on the fly.
In this way the utility can process any size of file.

Yes that is my favorite way. Way too many programs read all
the data into an array when it can easily be processed one at
a time and not stored.

One of my favorite is the algorithm for doing linear least
squares fits with sums over the appropriate combinations of the
input data, (and with a little luck to avoid intermediate overflow).

For Unix/C, with a little luck, you can have one array increase
in size without moving (after it gets reasonably large).

Otherwise, you need to do an allocate/copy/deallocate as the
data grows, which can be inefficient in time and memory.

-- glen
.