Counting lines in an ASCII file
There is more than one way to count lines in an ASCII file.
$SAMPLECODE$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 * #1 CREATE CURSOR test (C(1)) APPEND FROM (lcAsciiFileName) TYPE SDF lnRecCount = _TALLY USE IN temp * # 2. The line length cannot exceed 8192 bytes. Would return 1 for empty file lnRecCount = 0 lnFH = FOPEN(lcAsciiFileName) DO WHILE NOT FEOF(lnFH) = FGET(lnFH, 8192) lnRecCount = lnRecCount + 1 ENDDO * # 3. In pre-VFP 9.0 file must have 65,000 or less lines lnRecCount = ALINES(laTemp, FILETOSTR(lcAsciiFileName)) RELEASE laTemp * # 4 SET MEMOWIDTH TO 10000 && to prevent wordwrap ? MEMLINES(FILETOSTR(lcAsciiFileName))
Comments
Counting lines in Ascii file
Both should give the same answer. You would need to add 1 to the outcome to account for the last line which is not terminated with the CRLF or LF.
Occurs/ALINES with FileToStr