[GAP Forum] Changing line when printing to a text file

Dmitrii Pasechnik dmitrii.pasechnik at cs.ox.ac.uk
Fri Jan 31 11:33:19 GMT 2014


On Fri, Jan 31, 2014 at 12:05:57PM +0100, Hebert Pérez-Rosés wrote:
> Thanks a lot William, but it still doesn't work :-). By the way, according
> to Section 10.4-8, shouldn't it be
> 
> SetPrintFormattingStatus(outfile, true); ?
> 
> In any case, I've tried both options (true and false), and it still does
> not change lines. Maybe it's a Windows thing (I'm running GAP on Windows),
> or maybe it's an old bug that has already been corrected (I'm using GAP
> version 4.4.12). Any hint will be most welcome.

On Windows "\n" need not be the right character sequence for the end of line.
You might want to try "\r\n" instead.

HTH,
Dmitrii
> 
> Cheers,
> Hebert.
> 
> 
> 
> 2014-01-31 William DeMeo <williamdemeo at gmail.com>:
> 
> > Dear Herbert,
> >
> > You might try
> >
> >     outfile:= OutputTextFile(filename, false) ;
> >     SetPrintFormattingStatus(outfile, false);
> >
> > Then a line like yours,
> >
> >     Print(outfile, " ", out[i][2], "\n");
> >
> > might do what you expect. It seems to work for me.
> >
> > You could also read Section 10.4-8 of the manual.  I believe the
> > following link will take you directly there::
> >
> > http://www.gap-system.org/Manuals/doc/ref/chap10.html#X8663FCD57E8BC390
> >
> > Hope that helps.  Good luck!
> >
> > Sincerely,
> >
> > William
> >
> > --
> >   William DeMeo
> >   Department of Mathematics
> >   University of South Carolina
> >   1523 Greene Street
> >   Columbia, SC 29208
> >   USA
> >
> >   phone: 803-261-9135
> >   http://williamdemeo.org
> >   http://williamdemeo.github.io/CV
> > --
> >
> >
> > On Friday, January 31, 2014, Hebert Pérez-Rosés <hebert.perez at gmail.com>
> > wrote:
> > >
> > > Hi all,
> > >
> > > I am printing a function's output simultaneously to the standard output
> > > (the screen) and to a text file. On the screen the output appears
> > > correctly, but in the text file everything appears as a single line, i.e.
> > > there is no change of line. Here's my code:
> > >
> > >   LogOutputTo("C:/Tempo/GAP/outgraph.txt");
> > >   Print(n, " ", m, "\n");
> > >   for i in [1..m] do
> > >       Print(out[i][1], " ", out[i][2], "\n");
> > >   od;
> > >   LogOutputTo();
> > >
> > > What happens to the "\n" character?
> > >
> > > Thank you very much in advance,
> > > Hebert.
> > > _______________________________________________
> > > Forum mailing list
> > > Forum at mail.gap-system.org
> > > http://mail.gap-system.org/mailman/listinfo/forum
> >
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum



More information about the Forum mailing list