Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Open a txt file
Message
From
17/09/2003 17:00:23
 
 
To
17/09/2003 16:48:20
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00830099
Message ID:
00830109
Views:
20
>I just want to read the text.

for VFP 7 or +:

filetostr() will get all the content of file and store to a variable..

for VFP 6 or less, try it:
cwmydata = filetostring("c:\test1.txt")

FUNCTION filetostring
LPARAMETER lcdatafile
lndfh=FOPEN(lcdatafile)
lcparameter=""
IF  lndfh > 0
    nsize =  FSEEK(lndfh, 0, 2)           && Move to EOF
    IF  nsize <= 0                        && is empty
    ELSE
        = FSEEK(lndfh, 0, 0)
        DO WHILE NOT FEOF(lndfh)
            lcparameter=lcparameter+FREAD(lndfh,nsize)
            *
        ENDDO
        *
    ENDIF
    =FCLOSE(lndfh)
ELSE
    * Error opening data file
ENDIF
RETURN lcparameter
HTH
"Now to him who is able to do immeasurably more than all we ask or imagine, according to his power that is at work within us, Ephesians 3:20
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform