Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Low level file functions to get the number of lines
Message
 
 
To
22/07/1997 16:58:53
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00041205
Message ID:
00041209
Views:
39
>I am importing an ASCII file into a table. That file contains a special structures that bar code scanners are writting data into.
>
>Our import program is importing this data into our system. Before firing this process, I would like to be able to get the number of lines in that file so I can establish a thermometer. What would be the simpliest way of counting the number of lines from that file?

Michel:

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

HTH
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform