Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get lines from text file
Message
From
30/08/2006 22:41:59
 
 
To
30/08/2006 12:17:39
Reza Meamar
Homa Programming Group
Shiraz, Iran
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows '98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01149836
Message ID:
01150044
Views:
31
An alternative to arrays:
#DEFINE CRLF CHR(13)+CHR(10)
LOCAL lcText, lnNumLines, lnLine, lcLine
lcText = CRLF + FILETOSTR("myfile.txt")
IF RIGHT(lcText,2) = CRLF
  lnNumLines = OCCURS(CRLF,lcText) - 1
ELSE
  lnNumLines = OCCURS(CRLF,lcText)
ENDIF
FOR lnLine=1 TO lnNumLines
  lcLine = STREXTRACT(lcText,CRLF,CRLF,lnLine,2)
  ? lcLine
ENDFOR
The CRLF is added to the beginning to allow STREXTRACT to extract the first line.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform