> < ^ Date: Sat, 21 Apr 2001 00:15:31 -0700
> < ^ From: Andrew Solomon <andrew@illywhacker.net >
> < ^ Subject: Re: printing strings

Dear Markus,

On Fri, Apr 20, 2001 at 02:17:22PM -0500, Markus Pueschel wrote:
> Hello,
> 
> I have the following problem (GAP3). When printing a 
> long string to a file using the function PrintTo, the
> string is broken at a certain length and a "\" is inserted.
> It looks like: (this was a single string)
> 
> 246810121416182022242628303234363840424446485052545658606264666870727476788082\
> 848688909294969810010210410610811011211411611812012212412612813013213413613814\
> 014214414614815015215415615816016216416616817017217417617818018218418618819019\
> 2194196198200
> 
> How can I avoid the line-breaking or at least the insertion of
> backslashes?
> 
> Thanks, Markus
> 

PrintTo(<stream>,<object>) and AppendTo behave like Print and therefore break the lines
as though writing to screen (see Section 10.4 of the manual). In preference one uses
WriteAll(<stream>, <string>) which simply writes the string to the
stream byte-by-byte.

I believe the following does what you want.

gap> n; # n is an integer
246810121416182022242628303234363840424446485052545658606264666870727476788082848\
688909294969810010210410610811011211411611812012212412612813013213413613814014214\
414614815015215415615816016216416616817017217417617818018218418618819019219419619\
8200
gap> s := String(n); # convert the integer to a string
"24681012141618202224262830323436384042444648505254565860626466687072747678808284\
868890929496981001021041061081101121141161181201221241261281301321341361381401421\
441461481501521541561581601621641661681701721741761781801821841861881901921941961\
98200"

gap> filename := Filename(DirectoryCurrent(), "strtst");
"./strtst"

gap> output := OutputTextFile( filename, false );
OutputTextFile(./strtst)

gap> WriteAll(output,s);
true
gap> CloseStream(output);

Hope that helps,

Andrew

-- 
PIMS/MITACS/CECM                       http://www.cecm.sfu.ca
Simon Fraser University
Personal homepage:                     http://www.illywhacker.net

> < [top]