std::filesystem::directory_entry::hard_link_count

std::uintmax_t hard_link_count() const;
std::uintmax_t hard_link_count( std::error_code& ec ) const noexcept;
(C++17 起)

若硬链接数缓冲于此 directory_entry ,则返回缓冲的值。否则,各返回 std::filesystem::hard_link_count(path())std::filesystem::hard_link_count(path(), ec)

目录

参数

ec - 不抛出重载中报告错误的输出参数

返回值

被引用文件系统对象的硬链接数

异常

不接受 std::error_code& 参数的重载在底层 OS API 错误时抛出 filesystem_error ,以第一参数 p 和作为错误码参数的 OS 错误码构造。若内存分配失败则可能抛出 std::bad_alloc 。若 OS API 调用失败,则接受 std::error_code& 参数的重载设置该参数为 OS API 错误码,而若不出现错误则执行 ec.clear()

示例

参阅

返回引用到指定文件的硬链接数
(函数)

版本历史

  • (当前 | 先前) 2017年4月30日 (日) 01:06Fruderica讨论 | 贡献. . (809字节) (+809). . (以“{{cpp/filesystem/directory_entry/title|hard_link_count}} {{cpp/filesystem/directory_entry/navbar}} {{dcl begin}} {{dcl | since=c++17 | 1= std::uintmax_t hard_link_co...”为内容创建页面)