General information
Category:
Coding, syntax & commands
Title:
Checking to see if a file can be written to
Does anyone have a better way to do this, than the function below?
*********************
FUNCTION CanWrite
*********************
PARAM tcFile
LOCAL llCanWrite,lnHandle
IF NOT FILE(tcFile)
*File doesn't exist, so it can be created.
llCanWrite = .t.
ELSE
*If the file does exist, try to open it as
*read/write.
lnHandle = FOPEN(tcFile,2)
llCanWrite = (lnHandle > 0)
*Make sure the file gets closed. This will
*leave the file vulnerable to get opened by
*another person in the meantime.
FCLOSE(lnHandle)
ENDIF
RETURN llCanWrite
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only