number_of_lines(3f) - [M_io:QUERY] 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. If it is not readable -1 is returned.
lun logical unit number of open sequential file to count lines in.
nlines number of lines read. If it is not readable -1 is returned.
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 == 0)then write(*,*) number_of_lines(lun) else write(*,*)ERROR: IOS=,ios endif end program demo_number_of_lines
John S. Urban
Public Domain
Nemo Release 3.1 | number_of_lines (3) | February 23, 2025 |