A.29 library(writef): Old-style formatted write
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(writef): Old-style formatted write
          • writef/1
          • writef/2
          • swritef/2
          • swritef/3
    • Packages
Availability::- use_module(library(writef)).(can be autoloaded)
Source[det]writef(+Format)
[det]writef(+Format, +Arguments)
Formatted write to the current_output. Format is a format specifier. Some escape sequences require arguments that must be provided in the list Arguments. There are two types of escape sequences: special characters start with \ and include arguments start with %. The special character sequences are:
\n Output a newline character
\l Output a line separator (same as \n)
\r Output a carriage-return character (ASCII 13)
\r Output a TAB character (ASCII 9)
\\ Output \
\% Output %
\nnn Output character <nnn>. <nnn> is a 1-3 decimal number

Escape sequences to include arguments from Arguments. Each time a %-escape sequence is found in Format the next argument from Arguments is formatted according to the specification.

% print/1 the next item (mnemonic: term)
% write/1 the next item
% writeq/1 the next item
% display/1 the next item
% Put the next item as a character
% Write the next item N times where N is the second item (an integer)
% Write the next item as a String (so it must be a list of characters)
% Perform a ttyflush/0 (no items used)
%Nc Write the next item Centered in N columns.
%Nl Write the next item Left justified in N columns.
%Nr Write the next item Right justified in N columns.
deprecated
New code should use format/1, format/2, etc.