Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/fgetwc.html
2024-02-19 00:21:47 -05:00

216 lines
9.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>fgetwc</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="fgetwc"></a> <a name="tag_03_165"></a><!-- fgetwc -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_165_01"></a>NAME</h4>
<blockquote>fgetwc - get a wide-character code from a stream</blockquote>
<h4><a name="tag_03_165_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/stdio.h.html">stdio.h</a>&gt;<br>
#include &lt;<a href="../basedefs/wchar.h.html">wchar.h</a>&gt;<br>
<br>
wint_t fgetwc(FILE *</tt><i>stream</i><tt>);<br>
</tt></code></p>
</blockquote>
<h4><a name="tag_03_165_03"></a>DESCRIPTION</h4>
<blockquote>
<div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
border="0"> The functionality described on this reference page is aligned with the ISO&nbsp;C standard. Any conflict between the
requirements described here and the ISO&nbsp;C standard is unintentional. This volume of IEEE&nbsp;Std&nbsp;1003.1-2001 defers to
the ISO&nbsp;C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div>
<p>The <i>fgetwc</i>() function shall obtain the next character (if present) from the input stream pointed to by <i>stream</i>,
convert that to the corresponding wide-character code, and advance the associated file position indicator for the stream (if
defined).</p>
<p>If an error occurs, the resulting value of the file position indicator for the stream is unspecified.</p>
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The
<i>fgetwc</i>() function may mark the <i>st_atime</i> field of the file associated with <i>stream</i> for update. The
<i>st_atime</i> field shall be marked for update by the first successful execution of <a href=
"../functions/fgetc.html"><i>fgetc</i>()</a>, <a href="../functions/fgets.html"><i>fgets</i>()</a>, <i>fgetwc</i>(), <a href=
"../functions/fgetws.html"><i>fgetws</i>()</a>, <a href="../functions/fread.html"><i>fread</i>()</a>, <a href=
"../functions/fscanf.html"><i>fscanf</i>()</a>, <a href="../functions/getc.html"><i>getc</i>()</a>, <a href=
"../functions/getchar.html"><i>getchar</i>()</a>, <a href="../functions/gets.html"><i>gets</i>()</a>, or <a href=
"../functions/scanf.html"><i>scanf</i>()</a> using <i>stream</i> that returns data not supplied by a prior call to <a href=
"../functions/ungetc.html"><i>ungetc</i>()</a> or <a href="../functions/ungetwc.html"><i>ungetwc</i>()</a>. <img src=
"../images/opt-end.gif" alt="[Option End]" border="0"></p>
</blockquote>
<h4><a name="tag_03_165_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, the <i>fgetwc</i>() function shall return the wide-character code of the character read from the
input stream pointed to by <i>stream</i> converted to a type <b>wint_t</b>. If the stream is at end-of-file, the end-of-file
indicator for the stream shall be set and <i>fgetwc</i>() shall return WEOF. If a read error occurs, the error indicator for the
stream shall be set, <i>fgetwc</i>() shall return WEOF, <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src=
"../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;and shall set <i>errno</i> to indicate the error. <img src=
"../images/opt-end.gif" alt="[Option End]" border="0"> If an encoding error occurs, the error indicator for the stream shall be
set, <i>fgetwc</i>() shall return WEOF, and shall set <i>errno</i> to indicate the error.</p>
</blockquote>
<h4><a name="tag_03_165_05"></a>ERRORS</h4>
<blockquote>
<p>The <i>fgetwc</i>() function shall fail if data needs to be read and:</p>
<dl compact>
<dt>[EAGAIN]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The O_NONBLOCK flag is set for the file descriptor underlying <i>stream</i> and the process would be delayed in the <i>fgetwc</i>()
operation. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
<dt>[EBADF]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The file descriptor underlying <i>stream</i> is not a valid file descriptor open for reading. <img src="../images/opt-end.gif" alt=
"[Option End]" border="0"></dd>
<dt>[EILSEQ]</dt>
<dd>The data obtained from the input stream does not form a valid character.</dd>
<dt>[EINTR]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The read operation was terminated due to the receipt of a signal, and no data was transferred. <img src="../images/opt-end.gif"
alt="[Option End]" border="0"></dd>
<dt>[EIO]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> A
physical I/O error has occurred, or the process is in a background process group attempting to read from its controlling terminal,
and either the process is ignoring or blocking the SIGTTIN signal or the process group is orphaned. This error may also be
generated for implementation-defined reasons. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
<dt>[EOVERFLOW]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
The file is a regular file and an attempt was made to read at or beyond the offset maximum associated with the corresponding
stream. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
</dl>
<p>The <i>fgetwc</i>() function may fail if:</p>
<dl compact>
<dt>[ENOMEM]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
Insufficient storage space is available. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
<dt>[ENXIO]</dt>
<dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> A
request was made of a nonexistent device, or the request was outside the capabilities of the device. <img src=
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
</dl>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_165_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_165_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The <a href="../functions/ferror.html"><i>ferror</i>()</a> or <a href="../functions/feof.html"><i>feof</i>()</a> functions must
be used to distinguish between an error condition and an end-of-file condition.</p>
</blockquote>
<h4><a name="tag_03_165_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_165_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_165_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="feof.html"><i>feof</i>()</a> , <a href="ferror.html"><i>ferror</i>()</a> , <a href="fopen.html"><i>fopen</i>()</a> ,
the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/stdio.h.html"><i>&lt;stdio.h&gt;</i></a>, <a
href="../basedefs/wchar.h.html"><i>&lt;wchar.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_165_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 4. Derived from the MSE working draft.</p>
</blockquote>
<h4><a name="tag_03_165_12"></a>Issue 5</h4>
<blockquote>
<p>The Optional Header (OH) marking is removed from <a href="../basedefs/stdio.h.html"><i>&lt;stdio.h&gt;</i></a>.</p>
<p>Large File Summit extensions are added.</p>
</blockquote>
<h4><a name="tag_03_165_13"></a>Issue 6</h4>
<blockquote>
<p>Extensions beyond the ISO&nbsp;C standard are marked.</p>
<p>The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:</p>
<ul>
<li>
<p>The [EIO] and [EOVERFLOW] mandatory error conditions are added.</p>
</li>
<li>
<p>The [ENOMEM] and [ENXIO] optional error conditions are added.</p>
</li>
</ul>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>