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