number_of_lines(3f) - [M_io] read an open sequential file to get number of lines (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
function number_of_lines(lun) result(nlines)
integer,intent(in) :: lun integer :: nlines
Rewind an open sequential file and read through it to count the number of lines. The file is rewound on exit.
lun logical unit number of open sequential file to count lines in
nlines number of lines read
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
John S. Urban
Public Domain
number_of_lines (3) | March 11, 2021 |