C++ 中的 remove 和 unlink 函数有什么区别?
最佳答案
除了 unlink 是特定于 unix 的(正如 Chris 指出的那样),我们在 POSIX 手册中阅读:
If path does not name a directory, remove(path) is equivalent to unlink(path). If path names a directory, remove(path) is equivalent to rmdir(path).
至于目录传递的unlink
,我们阅读:
The path argument must not name a directory unless the process has appropriate privileges and the implementation supports using unlink() on directories. (...) Applications should use rmdir() to remove a directory.
关于c++ - 在 C++ 中取消链接与删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2192415/