View/Edit #1:file_length filelength

Switch to edit mode.

Name(s): file_length filelength
1:  ":file_length(<filename>)        => number of lines in file"
2:  {file} = args
3:  if (typeof(file) != $STR)
4:    raise(E_TYPE, "Filename must be a string.")
5:  endif
6:  fh = file_open($file_utils:filespec(this, file), "r-tf")
7:  count = 0
8:  try
9:    while (!file_eof(fh))
10:     `file_readline(fh) ! ANY => count = count - 1'
11:     count = count + 1
12:   endwhile
13: finally
14:   file_close(fh)
15: endtry
16: return count
17: "Last modified by whiz (#3135) on Mon Oct  8 21:11:04 2001 MDT."
18: "This verb previously owned by manta (#7165), and chowned to $slacker upon dewizarding (Sat Aug 17 14:50:04 2002 MDT)."
19: "Last modified by Dax (#789) on Mon Aug  7 21:32:55 2006 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Slacker (#55)

You are not logged in.

[home | help | who | search | setup | code]