ENC_UNICODE_BE
and ENC_UNICODE_LE
, sizeof(wchar_t)
for ENC_WCHAR
and 1 for all other encodings (including multibyte encodings such as
ENC_UTF8
.\n
when
in
SIO_LBUF
buffering mode and updates the stream position
information if enabled (SIO_RECORDPOS
). Returns 0 on
success, -1 on error.SIO_RECORDPOS
). Returns -1 on end of file or
error. Use Sferror()
or Sfeof() to
distinguish end of file from an error. This is a C macro.SIO_REPXML
႒
SIO_REPPL
\x4242\
SIO_REPPLU
\u4242
or
\U42424242
Updates the stream position information if enabled (SIO_RECORDPOS
)
0xfffd
is returned. Other errors and end-of-file return -1;
Use
Sferror() or Sfeof()
to distinguish end of file from an error.SIO_NBUF
).SIO_FEOF
flag, (2) test whether the
buffer is non-empty, (3) fill the buffer and return non-zero if the
Sread_function() returned 0 (zero).SIO_FLUSHOUTPUT
after the buffer was successfully written.long
. Whence is one of SIO_SEEK_SET
,
SIO_SEEK_CUR
or SIO_SEEK_END
, seeking relative
to the start, current position or end.SIO_CLOSE_TRYLOCK
which causes Sgcclose()
to return -1 with
errno set to EDEADLK
if the stream is locked.
Alternatively, using SIO_CLOSE_FORCE
the stream is closed
and released without gaining a lock. This should be safe because the
stream is garbage and thus no thread can use the lock.
In addition, Sgcclose() never raises a Prolog exception because Prolog interaction is not allowed from the blob release hook and there is no meaningful way to raise a Prolog exception from this context.
\n
character. On end-of-file or an error, NULL
is returned. If
the input line is longer that n bytes buf is not
0-terminated.Sfgets(buf,
Slinesize, Sinput)
. Deletes the terminating \n
character. Slinesize is a global variable that defines the
length of the input buffer. Deprecated.SIO_RP_BLOCK
, fill the buffer (possibly blocking) if the
buffer is empty. Update the stream position information unless flags
include SIO_RP_NOPOS
. This function effectively provides
functionality similar to POSIX read() on a stream. This function is used
by read_pending_codes/3.SIO_GETPENDING
.Sfputs(q,
Soutput)
.%
escape sequences. The %
character is
followed by numeric arguments and modifier characters. The generic
format of this is described by the regular expression [+-0 #]*(\d*|\*)(.(\d*|\*))?
.
Here, +
implies right alignment, -
left alignment, 0
0-padding and, a space white-space
padding and #
modified output. The
two optional numerical arguments are separated by a full stop and may be *
to get them from the argument list. The first numerical argument
specifies the field width and the second the precision for floating
point numbers.
This sequence is followed by optional type information. For integers
this is one of l
(long
), ll
(long
long
) or
z
(size_t
). For strings this is one of L
(ISO Latin 1), U
(UTF-8) or W
(wchar_t*
).
Finally we come to the format specifier. This is one of
%
%
character itself.
c
p
d
i
l
(long
), ll
(long long
) or z
(size_t
) denote
the size.
o
u
x
X
f
e
E
g
G
double
.
s
Unlike the POSIX fprintf(), this function returns the number of characters written. Due to multibyte encodings the number of bytes written can be more.
"%Ws"
.-1
is returned rather than the
number of bytes that would be written. Future versions may improve
compatibility with the POSIX functions."%Ws"
."%Ws"
.INVALID_SOCKET
NULL
, asking the system to allocate a
buffer or points at a buffer of (at least) the indicated size long. The
default buffer size is defined by the C macro SIO_BUFSIZE
PL_WRT_QUOTED
PL_WRT_IGNOREOPS
PL_WRT_NUMBERVARS
PL_WRT_PORTRAY
PL_WRT_CHARESCAPES
PL_WRT_NO_CHARESCAPES
PL_WRT_NO_CHARESCAPES
does not map to a write_term/2
option. If one of PL_WRT_CHARESCAPES
or PL_WRT_NO_CHARESCAPES
is specified, character escapes are (not) applied. If neither is
specified the default depends, like for write/1,
on the
character_escapes
flag on the module
user
.232Prior to
version 9.1.6 the default (no flag) was to escape the quotes and the
backslash (\
).PL_WRT_BACKQUOTED_STRING
PL_WRT_ATTVAR_IGNORE
PL_WRT_ATTVAR_DOTS
PL_WRT_ATTVAR_WRITE
PL_WRT_ATTVAR_PORTRAY
PL_WRT_BLOB_PORTRAY
PL_WRT_NO_CYCLES
PL_WRT_NEWLINE
PL_WRT_VARNAMES
PL_WRT_BACKQUOTE_IS_SYMBOL
PL_WRT_DOTLISTS
PL_WRT_BRACETERMS
PL_WRT_NODICT
PL_WRT_NODOTINATOM
PL_WRT_NO_LISTS
PL_WRT_RAT_NATURAL
PL_WRT_CHARESCAPES_UNICODE
PL_WRT_QUOTE_NON_ASCII
PL_WRT_PARTIAL
For example, to print a term to user_error
as the
toplevel does, use
PL_write_term(Suser_error, t, 1200, PL_WRT_QUOTED|PL_WRT_PORTRAY| PL_WRT_VARNAMES|PL_WRT_NEWLINE)