1FWIDE(3) Linux Programmer's Manual FWIDE(3)
2
3
4
6 fwide - set and determine the orientation of a FILE stream
7
9 #include <wchar.h>
10
11 int fwide(FILE *stream, int mode);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 fwide():
16 _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE
17 || _POSIX_C_SOURCE >= 200112L
18
20 When mode is zero, the fwide() function determines the current orienta‐
21 tion of stream. It returns a positive value if stream is wide-charac‐
22 ter oriented, that is, if wide-character I/O is permitted but char I/O
23 is disallowed. It returns a negative value if stream is byte oriented—
24 that is, if char I/O is permitted but wide-character I/O is disallowed.
25 It returns zero if stream has no orientation yet; in this case the next
26 I/O operation might change the orientation (to byte oriented if it is a
27 char I/O operation, or to wide-character oriented if it is a wide-char‐
28 acter I/O operation).
29
30 Once a stream has an orientation, it cannot be changed and persists un‐
31 til the stream is closed.
32
33 When mode is nonzero, the fwide() function first attempts to set
34 stream's orientation (to wide-character oriented if mode is greater
35 than 0, or to byte oriented if mode is less than 0). It then returns a
36 value denoting the current orientation, as above.
37
39 The fwide() function returns the stream's orientation, after possibly
40 changing it. A positive return value means wide-character oriented. A
41 negative return value means byte oriented. A return value of zero
42 means undecided.
43
45 POSIX.1-2001, POSIX.1-2008, C99.
46
48 Wide-character output to a byte oriented stream can be performed
49 through the fprintf(3) function with the %lc and %ls directives.
50
51 Char oriented output to a wide-character oriented stream can be per‐
52 formed through the fwprintf(3) function with the %c and %s directives.
53
55 fprintf(3), fwprintf(3)
56
58 This page is part of release 5.13 of the Linux man-pages project. A
59 description of the project, information about reporting bugs, and the
60 latest version of this page, can be found at
61 https://www.kernel.org/doc/man-pages/.
62
63
64
65GNU 2021-03-22 FWIDE(3)