3 <<fwide>>---set and determine the orientation of a FILE stream
12 int fwide(FILE *<[fp]>, int <[mode]>);
14 int _fwide_r(struct _reent *<[ptr]>, FILE *<[fp]>, int <[mode]>);
17 When <[mode]> is zero, the <<fwide>> function determines the current
18 orientation of <[fp]>. It returns a value > 0 if <[fp]> is
19 wide-character oriented, i.e. if wide character I/O is permitted but
20 char I/O is disallowed. It returns a value < 0 if <[fp]> is byte
21 oriented, i.e. if char I/O is permitted but wide character I/O is
22 disallowed. It returns zero if <[fp]> has no orientation yet; in
23 this case the next I/O operation might change the orientation (to byte
24 oriented if it is a char I/O operation, or to wide-character oriented
25 if it is a wide character I/O operation).
27 Once a stream has an orientation, it cannot be changed and persists
28 until the stream is closed, unless the stream is re-opened with freopen,
29 which removes the orientation of the stream.
31 When <[mode]> is non-zero, the <<fwide>> function first attempts to set
32 <[fp]>'s orientation (to wide-character oriented if <[mode]> > 0, or to
33 byte oriented if <[mode]> < 0). It then returns a value denoting the
34 current orientation, as above.
37 The <<fwide>> function returns <[fp]>'s orientation, after possibly
38 changing it. A return value > 0 means wide-character oriented. A return
39 value < 0 means byte oriented. A return value of zero means undecided.
51 _fwide_r (struct _reent
*ptr
,
59 _newlib_flockfile_start (fp
);
61 (void) ORIENT (fp
, mode
);
63 if (!(fp
->_flags
& __SORD
))
66 ret
= (fp
->_flags2
& __SWID
) ? 1 : -1;
67 _newlib_flockfile_end (fp
);
75 return _fwide_r (_REENT
, fp
, mode
);