[UP]


Manual Reference Pages  - number_of_lines (3)

NAME

number_of_lines(3f) - [M_io] read an open sequential file to get number of lines (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

function number_of_lines(lun) result(nlines)

   integer,intent(in)          :: lun
   integer                     :: nlines

DESCRIPTION

Rewind an open sequential file and read through it to count the number of lines. The file is rewound on exit.

OPTIONS

lun logical unit number of open sequential file to count lines in

RETURNS

nlines number of lines read

EXAMPLES

Sample program

   program demo_number_of_lines
   use M_io,      only : number_of_lines, fileopen
   implicit none
   integer :: ios
   integer :: lun
      lun=fileopen(’test.txt’,’r’,ios)
      if(ios.eq.0)then
         write(*,*) number_of_lines(lun)
      else
         write(*,*)’ERROR: IOS=’,ios
      endif
   end program demo_number_of_lines

AUTHOR

John S. Urban

LICENSE

Public Domain


number_of_lines (3) March 11, 2021
Generated by manServer 1.08 from 6b3d8360-8130-4bd2-9cfb-899a7489a79e using man macros.