Haskell語言Directory模塊中函數removeFile的用法及代碼示例。
用法類型:
FilePath -> IO ()
removeFilefile刪除現有文件file的目錄條目,其中file本身不是目錄。該實現可以指定在刪除文件之前必須滿足的其他約束(例如,其他進程可能未使用該文件)
示例1:
源碼:
import IO
import Directory
main = do x <- doesFileExist "/tmp/foo.txt"
print x
removeFile "/tmp/foo.txt"
y <- doesFileExist "/tmp/foo.txt"
print y
輸出:
True
輸出:
False
注:本文由純淨天空篩選整理自 haskell removeFile。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。