• 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-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>ftell - 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="fsetpos.html#fsetpos" title="fsetpos">
10<link rel="next" href="funopen.html#funopen" title="funopen">
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="ftell"></a>
29<p>
30Next:&nbsp;<a rel="next" accesskey="n" href="funopen.html#funopen">funopen</a>,
31Previous:&nbsp;<a rel="previous" accesskey="p" href="fsetpos.html#fsetpos">fsetpos</a>,
32Up:&nbsp;<a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a>
33<hr>
34</div>
35
36<h3 class="section">4.28 <code>ftell</code>, <code>ftello</code>&mdash;return position in a stream or file</h3>
37
38<p><a name="index-ftell-204"></a><a name="index-ftello-205"></a><a name="index-g_t_005fftell_005fr-206"></a><a name="index-g_t_005fftello_005fr-207"></a><strong>Synopsis</strong>
39<pre class="example">     #include &lt;stdio.h&gt;
40     long ftell(FILE *<var>fp</var>);
41     off_t ftello(FILE *<var>fp</var>);
42     long _ftell_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
43     off_t _ftello_r(struct _reent *<var>ptr</var>, FILE *<var>fp</var>);
44     
45</pre>
46   <p><strong>Description</strong><br>
47Objects of type <code>FILE</code> can have a &ldquo;position&rdquo; that records how much
48of the file your program has already read.  Many of the <code>stdio</code> functions
49depend on this position, and many change it as a side effect.
50
51   <p>The result of <code>ftell</code>/<code>ftello</code> is the current position for a file
52identified by <var>fp</var>.  If you record this result, you can later
53use it with <code>fseek</code>/<code>fseeko</code> to return the file to this
54position.  The difference between <code>ftell</code> and <code>ftello</code> is that
55<code>ftell</code> returns <code>long</code> and <code>ftello</code> returns <code>off_t</code>.
56
57   <p>In the current implementation, <code>ftell</code>/<code>ftello</code> simply uses a character
58count to represent the file position; this is the same number that
59would be recorded by <code>fgetpos</code>.
60
61   <p><br>
62<strong>Returns</strong><br>
63<code>ftell</code>/<code>ftello</code> return the file position, if possible.  If they cannot do
64this, they return <code>-1L</code>.  Failure occurs on streams that do not support
65positioning; the global <code>errno</code> indicates this condition with the
66value <code>ESPIPE</code>.
67
68   <p><br>
69<strong>Portability</strong><br>
70<code>ftell</code> is required by the ANSI C standard, but the meaning of its
71result (when successful) is not specified beyond requiring that it be
72acceptable as an argument to <code>fseek</code>.  In particular, other
73conforming C implementations may return a different result from
74<code>ftell</code> than what <code>fgetpos</code> records.
75
76   <p><code>ftello</code> is defined by the Single Unix specification.
77
78   <p>No supporting OS subroutines are required.
79
80   <p><br>
81
82   </body></html>
83
84