unlink vs remove在c ++中 [英] unlink vs remove in c++

查看:223
本文介绍了unlink vs remove在c ++中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++中的remove和unlink函数之间的区别是什么?

What is the difference between remove and unlink functions in C++?

推荐答案

除了unlink是unix- (如Chris所指出),我们在POSIX手册中阅读:

Apart from the fact that unlink is unix-specific (as pointed out by Chris), we read in the POSIX manual:


如果路径不命名目录,remove相当于unlink(路径)。
如果路径命名目录,则remove(path)等效于rmdir(path)。

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 ,我们读取:


path参数不能命名目录,除非该进程具有适当的权限,实现支持在目录上使用unlink()。 (...)应用程序应使用rmdir()删除目录。

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.

这篇关于unlink vs remove在c ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆