Blame man3/fwide.3

Packit 7cfc04
.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
Packit 7cfc04
.\" This is free documentation; you can redistribute it and/or
Packit 7cfc04
.\" modify it under the terms of the GNU General Public License as
Packit 7cfc04
.\" published by the Free Software Foundation; either version 2 of
Packit 7cfc04
.\" the License, or (at your option) any later version.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" References consulted:
Packit 7cfc04
.\"   GNU glibc-2 source code and manual
Packit 7cfc04
.\"   Dinkumware C library reference http://www.dinkumware.com/
Packit 7cfc04
.\"   OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
Packit 7cfc04
.\"   ISO/IEC 9899:1999
Packit 7cfc04
.\"
Packit 7cfc04
.TH FWIDE 3  2016-03-15 "GNU" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
fwide \- set and determine the orientation of a FILE stream
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.nf
Packit 7cfc04
.B #include <wchar.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int fwide(FILE *" stream ", int " mode );
Packit 7cfc04
.fi
Packit 7cfc04
.PP
Packit 7cfc04
.in -4n
Packit 7cfc04
Feature Test Macro Requirements for glibc (see
Packit 7cfc04
.BR feature_test_macros (7)):
Packit 7cfc04
.in
Packit 7cfc04
.ad l
Packit 7cfc04
.PP
Packit 7cfc04
.BR fwide ():
Packit 7cfc04
.RS 4
Packit 7cfc04
_XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE ||
Packit 7cfc04
.br
Packit 7cfc04
_POSIX_C_SOURCE\ >=\ 200112L
Packit 7cfc04
.RE
Packit 7cfc04
.ad
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
When \fImode\fP is zero, the
Packit 7cfc04
.BR fwide ()
Packit 7cfc04
function determines the current
Packit 7cfc04
orientation of \fIstream\fP.
Packit 7cfc04
It returns a positive value if \fIstream\fP is
Packit 7cfc04
wide-character oriented, that is, if wide-character I/O is permitted but char
Packit 7cfc04
I/O is disallowed.
Packit 7cfc04
It returns a negative value if \fIstream\fP is byte oriented\(emthat is,
Packit 7cfc04
if char I/O is permitted but wide-character I/O is disallowed.
Packit 7cfc04
It
Packit 7cfc04
returns zero if \fIstream\fP has no orientation yet; in this case the next
Packit 7cfc04
I/O operation might change the orientation (to byte oriented if it is a char
Packit 7cfc04
I/O operation, or to wide-character oriented if it is a wide-character I/O
Packit 7cfc04
operation).
Packit 7cfc04
.PP
Packit 7cfc04
Once a stream has an orientation, it cannot be changed and persists until
Packit 7cfc04
the stream is closed.
Packit 7cfc04
.PP
Packit 7cfc04
When \fImode\fP is nonzero, the
Packit 7cfc04
.BR fwide ()
Packit 7cfc04
function first attempts to set
Packit 7cfc04
\fIstream\fP's orientation (to wide-character oriented
Packit 7cfc04
if \fImode\fP is greater than 0, or
Packit 7cfc04
to byte oriented if \fImode\fP is less than 0).
Packit 7cfc04
It then returns a value denoting the
Packit 7cfc04
current orientation, as above.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
The
Packit 7cfc04
.BR fwide ()
Packit 7cfc04
function returns the stream's orientation, after possibly
Packit 7cfc04
changing it.
Packit 7cfc04
A positive return value means wide-character oriented.
Packit 7cfc04
A negative return value means byte oriented.
Packit 7cfc04
A return value of zero means undecided.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
POSIX.1-2001, POSIX.1-2008, C99.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
Wide-character output to a byte oriented stream can be performed through the
Packit 7cfc04
.BR fprintf (3)
Packit 7cfc04
function with the
Packit 7cfc04
.B %lc
Packit 7cfc04
and
Packit 7cfc04
.B %ls
Packit 7cfc04
directives.
Packit 7cfc04
.PP
Packit 7cfc04
Char oriented output to a wide-character oriented stream can be performed
Packit 7cfc04
through the
Packit 7cfc04
.BR fwprintf (3)
Packit 7cfc04
function with the
Packit 7cfc04
.B %c
Packit 7cfc04
and
Packit 7cfc04
.B %s
Packit 7cfc04
directives.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR fprintf (3),
Packit 7cfc04
.BR fwprintf (3)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.