1<html lang="en"> 2<head> 3<title>fwide - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Stdio.html#Stdio" title="Stdio"> 9<link rel="prev" href="funopen.html#funopen" title="funopen"> 10<link rel="next" href="fwrite.html#fwrite" title="fwrite"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="fwide"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="fwrite.html#fwrite">fwrite</a>, 31Previous: <a rel="previous" accesskey="p" href="funopen.html#funopen">funopen</a>, 32Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 33<hr> 34</div> 35 36<h3 class="section">4.30 <code>fwide</code>—set and determine the orientation of a FILE stream</h3> 37 38<p><a name="index-fwide-211"></a><a name="index-g_t_005ffwide_005fr-212"></a><strong>Synopsis</strong> 39<pre class="example"> #include <wchar.h> 40 int fwide(FILE *<var>fp</var>, int <var>mode</var>) 41 42 int _fwide_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>, int <var>mode</var>) 43 44</pre> 45 <p><strong>Description</strong><br> 46When <var>mode</var> is zero, the <code>fwide</code> function determines the current 47orientation of <var>fp</var>. It returns a value > 0 if <var>fp</var> is 48wide-character oriented, i.e. if wide character I/O is permitted but 49char I/O is disallowed. It returns a value < 0 if <var>fp</var> is byte 50oriented, i.e. if char I/O is permitted but wide character I/O is 51disallowed. It returns zero if <var>fp</var> has no orientation yet; in 52this case the next I/O operation might change the orientation (to byte 53oriented if it is a char I/O operation, or to wide-character oriented 54if it is a wide character I/O operation). 55 56 <p>Once a stream has an orientation, it cannot be changed and persists 57until the stream is closed, unless the stream is re-opened with freopen, 58which removes the orientation of the stream. 59 60 <p>When <var>mode</var> is non-zero, the <code>fwide</code> function first attempts to set 61<var>fp</var>'s orientation (to wide-character oriented if <var>mode</var> > 0, or to 62byte oriented if <var>mode</var> < 0). It then returns a value denoting the 63current orientation, as above. 64 65 <p><br> 66<strong>Returns</strong><br> 67The <code>fwide</code> function returns <var>fp</var>'s orientation, after possibly 68changing it. A return value > 0 means wide-character oriented. A return 69value < 0 means byte oriented. A return value of zero means undecided. 70 71 <p><br> 72<strong>Portability</strong><br> 73C99, POSIX.1-2001. 74 75 <p><br> 76 77 </body></html> 78 79