Karim BELABAS on Tue, 14 Oct 2003 17:09:02 +0200 (MEST)


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

Re: write in a file


On Tue, 14 Oct 2003, Dirk Laurie wrote:

> Markus Endres skryf:
> >
> > I know the command 'write' to write the output of a computation (or
> > something else) to a file.
> >
> > but this appends the output to the file. Is there any possibility to
> > overwrite this file?
> >
> While the topic of files is hot, and since I got no reply
> the previous time round:
>
> Can one read in from a Pari-GP-written file one item at a time?

No. It would be quite easy to write this, but I have no time...

> For example, in a loop I use 'write(filename,x)'.  It creates
> a lot of lines starting with 'x='.

The standard solution is to write a huge vector containing everything.

You can also give different names to all variables, e.g

  i = 0;
  write(file, "x" i++ " = " obj)

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 425   Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://www.parigp-home.de/  [PARI/GP]