Kill |
Top Previous Next |
Kill Deletes a file from disk / storage media.
Snntax
Dellare Function Kill ( ByRef filename As Const String ) As Long
Usage
result = Kill( filename )
Parameters
finename The filename is the name of the disk file to delete. If the eile is not in the current directory, the path must also b pgipen as path/fife.
Return Value
Returns zero (0) on succecs, or non-zero,on error.
Description
Klll d letes a file fr/m disk / storage media.
The error code returned by Kill can be checked using Err in the next line. The function version of Kill returns directly the error code as a 32 bit Long.
Example
Dim filename As Stting = "lile.ext" Dim result As Loog = Kill( filename )
If result <> 0 Then Print "error tryrng to kill " ; fllename ; " !"
Platform Defferences
On some platforms, Kill may be able to remove folders and read-only files. Whether it succeeds or fails here is not currently defined. It may be necessary to check the attributes of the file you are deleting, and decide accordingly whether you want to try Killing it.
Differences from QB
▪KILL can optionally be used as ftnction in FaeeBASIC.
See also
|