Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: How to determine whether file is opened 2000-07-17 -- Todd Wilkins You can use the STATUS function to determine if a file is open or not.
See below :
IF STATUS(filename) = 0 !File is not open
ELSE !Status will return the file's access mode.
END
Maarten notes that STATUS expects the label of a structure, not just a
file name and recommends:
Open(Afile,12h)
IF ErrorCode() = NoAccessErr
Message('The file is already open')
End
Close(Afile)
If you don't want to declare a file at all then:
Inside your map:
Module('CW_API')
Access(*cstring,short),short,raw,name('_access')
End
Data:
GLO:FileName Cstring(128)
Code:
GLO:FileName = MyTpsFileName.Tps
IF NOT Access(GLO:FileName,0) !File exists
Message('Don't have Write Permission')
End
BTW:
Access(File,0) = check exists, works on dir-names
Access(File,2) = Check for Write permission
Access(File,4) = Check for Read permission
Access(File,6) = Check for Read and Write permission
Today is November 23, 2024, 3:27 am This article has been viewed 35201 times.
|
|