Subject: Re: [SWIPL] writef bug?

From: Jan Wielemaker <[email-masked]>
Date: Tue, 13 Feb 2001 11:54:28 +0100

> According to the writef/2 help, the string '\\' should print a (single)
> backslash character.
> However, using SWI-prolog version 3.4.4 (NT), I get the following error:
> 
> ?- writef('\\').
> ERROR: Arithmetic: `''/0' is not a function
> ?- 
> 
> Is this a bug or am I doing something really stupid?

Using writef :-)

The problem is that ISO character escapes interfere with writef.  So ISO
turns writef('\\') into writef(\), which makes writef unhappy.  This
requires a bit of thinking. To write a \ you need \\\\. To write a
newline however \\n and \n produce the same result.

I would suggest using format/[2,3].  

	--- Jan