[GAP Forum] Writing to File

Alexander Konovalov gap at gap.zssm.zp.ua
Sun Apr 18 19:10:01 BST 2004

Dear Bruce,

if  I  understand your task perfectly, you would like to write certain
information  to  the  text file and you need to increase the number of
symbols per line in the output file.

There are several approaches to this.

The  simplest,  but  less flexible is to use 'LogTo("filename");'
and it will just copy the output from the screen to the file.
In this case you may use the command 'SizeScreen([256,]);' to
reach the maximum possible length of the line, but no more than 256

More  opportunities  are  provided  by  using  streams, and it is very
useful  that  your  are  already  looking  in  this direction. Indeed,
'DirectoryTemporary()'  works  only  for  UNIX-type  systems, but this
function  is  not  essential in reaching your aims. In the example you
cited  this  function  is  used  to create a filename in the temporary
directory, but you may enter the next command from this example in the

output := OutputTextFile( "filename", true );;

and it will create the file "filename" just in your current directory.

Line  length  in  this  file  can  also be regulated by the SizeScreen
command   -   it   will  be  changed  on  screen  and  in  the  stream

You could also be interested *** to have all output in one single line
of  text  without  line  breaks *** - in conditions above, this may be
achieved entering the command

SetPrintFormattingStatus( out, false )

Hope this helps.

Sincerely yours,
Alexander Konovalov

On Sunday, April 18, 2004 at 4:46:57 PM 
Bruce W. Colletti <bcolletti at compuserve.com> wrote:

> Re GAP 4.3fix4 running under WinXP Home.

> How do I set the record length of an output text file?

> When printing to the file, numbers follow one another (as desired) until too many occur, at which time GAP automatically creates a new output line.  Numbers are separated by a space or tab.

> LogTo("filename") opens the file...maybe that's the problem.  If so, what else should I use?  I've tried an example in the manual that starts:

>     name := Filename(DirectoryTemporary(),"test");

> but GAP gags on the DirectoryTemporary() command.

> Thanks.

> Bruce

> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum

More information about the Forum mailing list