Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / The way to use LINES

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. The way to use LINES
#5149
Posted by: Jeff Glatt 2004-09-24 05:38:49 Last edited by: Jeff Glatt 2007-08-14 06:15:50 (Total edited 1 time)
The LINES() built-in function can do one of two things:

1) It can tell you if there is at least one more line to be read from a file.

2) It can tell you exactly how many more lines can be read from a file.

The way to tell LINES to do #1 is to pass a second argument of 'N' like so:
/* Ask if there is another line to read */
IF LINES('C:\MyFilename', 'N') > 0 THEN
   SAY "Yes, there is another line to read."
ELSE
   SAY "No, there is not another line to read."
Here's how you find out exactly how many more lines need to be read:
howmany = LINES('C:\MyFilename')
SAY "There are" howmany "more lines to read."
The time it takes to do #2 is a lot longer than the time it takes to do #1. So, if you're using LINES just to find out if there is another line to read (for example, using it to determine whether to loop around and read another line, then definitely pass the second arg of "N". That could speed up your loop).

For more information, read the REXX Reference book: chapter "Files/Directories/Devices (Streams)", page "Reading a file", under the section "Determine how many lines can be read".
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-26  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0