std::filesystem::space_info

定义于头文件 <filesystem>
struct space_info {

    std::uintmax_t capacity;
    std::uintmax_t free;
    std::uintmax_t available;

};
(C++17 起)

代表如 space 所确定的文件系统信息。

成员拥有下列含义:

示例

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
    fs::space_info devi = fs::space("/dev/null");
    fs::space_info tmpi = fs::space("/tmp");
 
    std::cout << ".        Capacity       Free      Available\n"
              << "/dev:   " << devi.capacity << "   "
              << devi.free << "   " << devi.available  << '\n'
              << "/tmp: " << tmpi.capacity << " "
              << tmpi.free << " " << tmpi.available  << '\n';
}

可能的输出:

.         Capacity       Free      Available
/dev:   4175114240   4175110144   4175110144
/tmp: 420651237376 411962273792 390570749952

参阅

(C++17)
确定文件系统上的可用空闲空间
(函数)

版本历史

  • (当前 | 先前 2017年4月30日 (日) 10:00Fruderica讨论 | 贡献 . . (713字节) (+3). . (撤销)
  • 当前 | 先前) 2017年4月30日 (日) 10:00Fruderica讨论 | 贡献. . (710字节) (+710). . (以“{{cpp/filesystem/title|space_info}} {{cpp/filesystem/navbar}} {{dcl begin}} {{dcl header | filesystem}} {{dcl | since=c++17 | 1= struct space_info { std::uintmax...”为内容创建页面)