Hi, I would like to make a little program say with a button that when you click, it will delete a file on your computer like on the desktop, I want to know what command to use, and an example please, thanks!!
In order to delete a file with FileIO Xtra, you need to first open the file. For example:
--
fileIO = new(xtra "fileIO")
fileIpenFile("c:\doc.txt ", 0)
fileIO.delete()
fileIO = VOID
--
For how to use FileIO Xtra, go to:
<
If you try to open a non-existent file with FileIO, it will generate an error code. You can check if the file exists using this function:
--
fileIO = new(xtra "fileIO")
fileIpenFile("c:\nonexistentfile.txt ", 0)
errorCode = fileIO.status()
errorStr = fileIO.error(errorCode)
put errorStr
--
This returns:
-- "Bad file name"
However if you use Buddy API baFileExists function, it's very simple:
--
put baFileExists("c:\nonexistentfile.txt")
-- 0
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.