lcFileName = "..." IF FILE(lcFileName) .txtbxdefault.Value = FILETOSTR(lcFileName) ELSE STRTOFILE("", lcFileName) ENDIFI's also not a good idea to store any files in the root of C: drive.
>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()