Herbert Gangl on Tue, 14 Oct 2003 17:13:41 +0200 (MEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: write in a file


> Can one read in from a Pari-GP-written file one item at a time?
> For example, in a loop I use 'write(filename,x)'.  It creates
> a lot of lines starting with 'x='.
>
> If I say 'read(filename)', the whole file is read, and all the
> values of x except the last are lost.  I want to read one, do
> something to it, read another, etc.
Quick (unelegant) suggestion: use a list, starting as an empty one,
   n=2000; \\ (say)
   lst = listcreate(n);
and use
   listput(lst, newdata);
in your loop (instead of writing to the file directly) and output
the list
   write(filename,lst);
instead of the individual entries.

Will that do the trick?

	herbert