Dr. Robert J. Harley on Tue, 14 Oct 2003 18:19:26 +0200 (CEST)


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

Re: write in a file


Dirk Laurie wrote:
>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.

How about something like:

  filename="log"
  for(i=1,10,write(filename, "dostuff(" i ");"));
  dostuff(i)=print("The value was " i);
  \r log

?

Regards,
  Rob.
     .-.                                                               .-.
    /   \           .-.                                 .-.           /   \
   /     \         /   \       .-.     _     .-.       /   \         /     \
  /       \       /     \     /   \   / \   /   \     /     \       /       \
 /         \     /       \   /     `-'   `-'     \   /       \     /         \
            \   /         `-'                     `-'         \   /
             `-'                                               `-'