>>>Let's not
squabble. Some good suggestions were made here. Everyone knows that there are nice ways to Sunday to accomplish the same task in VFP. Performance is often negligible between different approaches.
>>
>>Thanks for the new word for me, James :) Now, I didn't intend to squabble. My point was that not all suggestions could be applied to huge files. That's it.
>
>Nadya,
>
>The text file you are talking about would have to be truly huge! In most situations I don't think it would be a problem:
>
>Maximum # of characters per character string or memory variable--16,777,184
James,
(not intending any squabble - .2 cents addition:)
In a previous reply I saw fread() to count lines.
Real problem with fread() it should be done byte by byte. The code I saw would error on first call to fread. fgets() could be used but it has a bug (cannot handle lines > 8192chars - maybe fixed in SP4?) OTOH for huge files (>1 billion lines < bg >) lowlevel sounds to be the only way (for >2Gb files I don't have an idea what OS response would be).
IMHO Barbara's original reply is the best with a slight modification (so it's faster than array approach too):
create cursor dummy (f1 l)
append from (lcFile) type sdf
nLines = reccount()
use in 'dummy'
Best regards
Cetin