text output



Dnia Fri, 29 Jan 2010 16:02:34 -0700, Robert Dodier napisa?(a):

> On Thu, Jan 28, 2010 at 11:10 AM, Adam Majewski <adammaj1 at o2.pl> wrote:
> 
>> I have a list of integers :
>> a: [1,0,0]
>>
>> I want to save it as a list of integer ( one in a line) ?in a text file
>> :
>>
>> 1
>> 0
>> 0
> 
> How about this:
> 
> S : openw ("tmp.txt");
> for x in a do printf (S, "~a~%", x);
> close (S);
> 
> HTH
> 
> Robert Dodier

Thx. It works.

Adam

Here is my code for creating txt file : 


m(period):=
block(
[P,degree,a,f,
comment:concat("! this is an input file for mpsolve and eigensolve for 
centers of hyperbolic components of Mandelbrot set of period = ",string
(period)),
f_name:concat("cc",string(period),".pol")],
P:C[period],
degree:hipow(P,c),
a:makelist(coeff(P,c,i),i,0,degree),
f : openw (f_name),
printf(f, "~a~%", comment),
printf(f, "~a~%", "dri"),
printf(f, "~d~%", 0),
printf(f, "~d~%", degree),
for x in a do printf (f, "~d~%", x),
close (f));