procedure rdlist(infile,nline) string infile {prompt="file name"} int nline {prompt="number of line to parse"} string cline {prompt="parsed line"} # @(#) task rdlist Author: R.A. Jansen -- April 23 1995 # @(#) # @(#) task to return the (string) value of the n-th line in a file as a # @(#) task parameter. # @(#) NB: 'fscan' limits the length of lines, that can be passed intact # @(#) to parameter rdlist.cline, to 62 characters; this applies to the # @(#) length of the file name string 'infile', as well! # @(#) Jun 12 2000 -- Added test for existence of 'infile'. begin string cstr struct line int n n = 0 cline="INDEF" # Check whether the input file exists ... chkimg (infile, "access", imtype="file", verbose=yes) if (!chkimg.ok) { return } list = infile while ( fscan(list,line) != EOF ) { cstr = line n += 1 if ( n == nline ) { cline = cstr } } list = "" end