Unreliable File Deletion

Richard Gaskin ambassador at fourthworld.com
Sun Mar 28 15:42:54 EDT 2021


R.H. wrote:

 > The similar or same problem as you have: I want to delete the text
 > file. The command I issue is "detele file <pathname>". The error it
 > returns: "Can't delete file".

LC's result will tell you only the general fact that a file I/O 
operation failed, but not why.

The syserror() function will tell you why, delivering the specific 
integer code for the error the OS reported back to LC.

Establishing a habit of always including a call to sysError when 
reporting a non-empty result will save you countless hours of diagnostic 
time, e.g.:

   delete file tFile
   if the result is not empty then
       answer the result &" ("& sysError() &")"
   end if


-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list