C Library Functions - number_of_lines (3)
NAME
number_of_lines(3f) - [M_io:QUERY] 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. If it is not readable -1 is returned.
OPTIONS
|
lun |
logical unit number of open sequential file to count lines in.
|
|
RETURNS
|
nlines |
number of lines read. If it is not readable -1 is returned.
|
|
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 == 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
| Nemo Release 3.1 | number_of_lines (3) | June 29, 2025 |
Generated by manServer 1.08 from f0005ff6-b370-48ec-82e0-10104f52d369 using man macros.