摘要: #include <iostream> #include <filesystem> #include <string> namespace fs = std::filesystem; void demo_status(const fs::path& p, fs::file_status s) { s 阅读全文
posted @ 2023-12-04 13:31 经纬视界 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1.path类:文件路径相关操作,如指定的路径是否存在等; 2.directory_entry类:获取文件属性等,如指定文件是否是常规文件,还包括文件大小、文件最后修改时间; 3.directory_iterator类:遍历目录,获取目录文件,不包括子目录,其介绍参见; 4.recursive_di 阅读全文
posted @ 2023-12-04 13:25 经纬视界 阅读(12) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <fstream> using namespace std; int main() { ifstream infile; try { infile.open("file.txt"); if (!infile) { throw runtime_ 阅读全文
posted @ 2023-12-04 13:21 经纬视界 阅读(5) 评论(0) 推荐(0) 编辑