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

William DeMeo williamdemeo at gmail.com
Fri Jan 31 10:03:59 GMT 2014


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



More information about the Forum mailing list