• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>getchar - 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="getc_005funlocked.html#getc_005funlocked" title="getc_unlocked">
10<link rel="next" href="getchar_005funlocked.html#getchar_005funlocked" title="getchar_unlocked">
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="getchar"></a>
29<p>
30Next:&nbsp;<a rel="next" accesskey="n" href="getchar_005funlocked.html#getchar_005funlocked">getchar_unlocked</a>,
31Previous:&nbsp;<a rel="previous" accesskey="p" href="getc_005funlocked.html#getc_005funlocked">getc_unlocked</a>,
32Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
33<hr>
34</div>
35
36<h3 class="section">4.34 <code>getchar</code>&mdash;read a character (macro)</h3>
37
38<p><a name="index-getchar-218"></a><a name="index-g_t_005fgetchar_005fr-219"></a><strong>Synopsis</strong>
39<pre class="example">     #include &lt;stdio.h&gt;
40     int getchar(void);
41     
42     int _getchar_r(struct _reent *<var>reent</var>);
43     
44</pre>
45   <p><strong>Description</strong><br>
46<code>getchar</code> is a macro, defined in <code>stdio.h</code>.  You can use <code>getchar</code>
47to get the next single character from the standard input stream. 
48As a side effect, <code>getchar</code> advances the standard input's
49current position indicator.
50
51   <p>The alternate function <code>_getchar_r</code> is a reentrant version.  The
52extra argument <var>reent</var> is a pointer to a reentrancy structure.
53
54   <p><br>
55<strong>Returns</strong><br>
56The next character (read as an <code>unsigned char</code>, and cast to
57<code>int</code>), unless there is no more data, or the host system reports a
58read error; in either of these situations, <code>getchar</code> returns <code>EOF</code>.
59
60   <p>You can distinguish the two situations that cause an <code>EOF</code> result by
61using `<code>ferror(stdin)</code>' and `<code>feof(stdin)</code>'.
62
63   <p><br>
64<strong>Portability</strong><br>
65ANSI C requires <code>getchar</code>; it suggests, but does not require, that
66<code>getchar</code> be implemented as a macro.
67
68   <p>Supporting OS subroutines required: <code>close</code>, <code>fstat</code>, <code>isatty</code>,
69<code>lseek</code>, <code>read</code>, <code>sbrk</code>, <code>write</code>.
70
71   <p><br>
72
73   </body></html>
74
75