Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text file
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Environment versions
Visual FoxPro:
VFP 6
Database:
MS SQL Server
Miscellaneous
Thread ID:
01043078
Message ID:
01043097
Views:
12
I would do it differently.
lcFileName = "..."
IF FILE(lcFileName)
  .txtbxdefault.Value = FILETOSTR(lcFileName)
ELSE
  STRTOFILE("", lcFileName)
ENDIF
I's also not a good idea to store any files in the root of C: drive.

>Here is my code
>IF FILE('C:\Swini.txt')= .F.  && Does file exist?
>        = FCREATE('C:\Swini.txt')  && If not create it
>    ELSE
>        gnFileHandle = FOPEN('C:\Swini.txt',0)
>        nSize =  FSEEK(gnFileHandle, 0, 2)     && Move pointer to EOF
>        IF nSize > 0
>            = FSEEK(gnFileHandle, 0, 0)      && Move pointer to BOF
>            .txtbxdefault.Value = Alltrim(FREAD(gnFileHandle, nSize))
>        ENDIF
>    ENDIF
>    = FCLOSE(gnFileHandle)
>However, next time I need to execute the same routine, fopen() returns -1, even though the file is not open. Thus, how can I open the file using fopen()
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform