1<html lang="en"> 2<head> 3<title>getw - 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="gets.html#gets" title="gets"> 10<link rel="next" href="getwchar.html#getwchar" title="getwchar"> 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="getw"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="getwchar.html#getwchar">getwchar</a>, 31Previous: <a rel="previous" accesskey="p" href="gets.html#gets">gets</a>, 32Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 33<hr> 34</div> 35 36<h3 class="section">4.39 <code>getw</code>—read a word (int)</h3> 37 38<p><a name="index-getw-227"></a><strong>Synopsis</strong> 39<pre class="example"> #include <stdio.h> 40 int getw(FILE *<var>fp</var>); 41 42</pre> 43 <p><strong>Description</strong><br> 44<code>getw</code> is a function, defined in <code>stdio.h</code>. You can use <code>getw</code> 45to get the next word from the file or stream identified by <var>fp</var>. As 46a side effect, <code>getw</code> advances the file's current position 47indicator. 48 49 <p><br> 50<strong>Returns</strong><br> 51The next word (read as an <code>int</code>), unless there is no more 52data or the host system reports a read error; in either of these 53situations, <code>getw</code> returns <code>EOF</code>. Since <code>EOF</code> is a valid 54<code>int</code>, you must use <code>ferror</code> or <code>feof</code> to distinguish these 55situations. 56 57 <p><br> 58<strong>Portability</strong><br> 59<code>getw</code> is a remnant of K&R C; it is not part of any ISO C Standard. 60<code>fread</code> should be used instead. In fact, this implementation of 61<code>getw</code> is based upon <code>fread</code>. 62 63 <p>Supporting OS subroutines required: <code>fread</code>. 64<br> 65 66 </body></html> 67 68