]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/ftell.rst
fcd0e2657668776586561e2b729cd37125a592d4
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / ftell.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: FTELL, file operation, position
7
8 .. _ftell:
9
10 FTELL --- Current stream position
11 *********************************
12
13 .. function:: FTELL(UNIT)
14
15 Retrieves the current position within an open file.
16
17 :param OFFSET:
18 Shall of type ``INTEGER``.
19
20 :param UNIT:
21 Shall of type ``INTEGER``.
22
23 :return:
24 In either syntax, :samp:`{OFFSET}` is set to the current offset of unit
25 number :samp:`{UNIT}`, or to -1 if the unit is not currently open.
26
27 Standard:
28 GNU extension
29
30 Class:
31 Subroutine, function
32
33 Syntax:
34 .. code-block:: fortran
35
36 CALL FTELL(UNIT, OFFSET)
37 OFFSET = FTELL(UNIT)
38
39 Example:
40 .. code-block:: fortran
41
42 PROGRAM test_ftell
43 INTEGER :: i
44 OPEN(10, FILE="temp.dat")
45 CALL ftell(10,i)
46 WRITE(*,*) i
47 END PROGRAM
48
49 See also:
50 :ref:`FSEEK`