Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Low level file functions to get the number of lines
Message
From
22/07/1997 17:17:27
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00041205
Message ID:
00041210
Views:
36
>I think in the help of FP 2.5, if you issue FREAD(lnHandle, 254), this will read to the end of the line. So if you code:
>
>lnHandle=fopen("MyTextFile.txt")
>=fseek(lnHandle,0) && moves to beginning of file.
>lnLines=0
>do while !feof(lnHandle)
> =fread(lnHandle, 254)
> lnLines=lnLines+1
>enddo
>=fclose(lnHandle)
>return lnLines

Yes, but this will require a scan of the file.

BTW, after a FOPEN(), aren't we at the beginning of the file?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform