`
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 Printed November 21, 2024, 12:02 pm This article has been viewed/printed 35198 times. |