On Thu, Aug 01, 2002 at 05:50:17AM +0900, James F.Hranicky wrote: > def rewind(lines) > > seek(0, IO::SEEK_END) > > lines = lines.abs > numlines = 0 > size = stat.size - 1 > > size.downto(0) { |filepos| > next if (size == filepos) > seek(filepos, IO::SEEK_SET) > i = getc > c = sprintf("%c", i) > numlines += 1 if (c == "\n") Could this be replaced with: numlines += 1 if getc() == ?\n > return if (numlines == lines) > } > end Paul