jjzjj

fileSystem

全部标签

C++17 支持 Eclipse Neon

我读了here尽管规范尚未完全准备好,但C++17功能完备。如何在我的代码中使用C++17功能,尤其是在EclipseCDT(Neon)中?具体来说,我想使用文件系统来轻松地遍历目录。 最佳答案 libc++和libstdc++在最近的版本中都有一个std::experimental::filesystem。我不知道直接拥有std::filesystem;C++17还没有完全发布,这似乎是合理的。boost有boost::filesystem,它们在一些方面有所不同,但结构几乎相同。使用boost::filesystem编写的代码可

c++ - 从 ‘boost::filesystem3::path’ 到非标量类型‘std::string’的 boost 错误转换

我有代码:std::stringfirstFile=boost::filesystem::path(first->name()).leaf();但是报错:errorconversionfrom‘boost::filesystem3::path’tonon-scalartype‘std::string我该如何解决?谢谢。 最佳答案 std::stringfirstFile=boost::filesystem::path(first->name()).leaf().string();另请注意,leaf函数已弃用并在Boost.Files

c++ - Boost 选项 - 获取应用程序名称

是否有使用Boost获取应用程序名称的简单方法(可能使用boost::program_options?)事情会是这样的:有argv[0]="c:\foo\bar\appname.exe"我想要var1="appname" 最佳答案 您可以使用boost::filesystem从路径中提取名称。看起来像这样:#includeboost::filesystem::pathp=argv[0];std::stringvar1=p.stem().string(); 关于c++-Boost选项-获取

c++ - 如何比较 time_t 和 std::filesystem::file_time_type

我正在将一些代码从boost::filesystem转换到std::filesystem。以前使用的代码boost::filesystem::last_write_time()它返回一个time_t,因此直接与我已经持有的time_t对象进行比较是微不足道的。顺便说一句,我持有的这个time_t是从很久以前保存的文件内容中读取的,所以我坚持使用这种“自unix纪元以来的时间”类型。std::filesystem::last_write_time返回std::filesystem::file_time_type.是否有可移植的方法将file_time_type转换为time_t,或者以其

c++ - 如何递归复制文件和目录

使用C++,是否可以递归地将文件和目录从一个路径复制到另一个路径无需使用任何额外的库?并具有独立于平台的功能?考虑以下文件系统src/fileInRootsrc/sub_directory/src/sub_directory/fileInSubdir我要复制所有文件和目录或某些文件和目录从src到另一个目录target。我创建了一个新问题,因为我发现的问题是特定于平台的,不包括过滤:C++Copydirectoryrecursiveunderunix(unix)Copydirectorycontent(Linux)C/C++Copyfilewithautomaticrecursivef

c++ - 如何在 boost::filesystem 中使用 copy_file?

我想将一个文件从一个目录复制到另一个目录,但我的程序总是因为某些原因而中止。之前有没有人这样做过,可以告诉我哪里出了问题吗?我怎么能捕捉到copy_file抛出的异常,我查看了boost网站,但我找不到任何关于异常的相关信息。pathuser_path("C:\\MyFolder");boost::filesystem::create_directory(user_path);pathfile("C:\\Another\\file.txt");boost::filesystem::copy_file(file,user_path);谢谢, 最佳答案

c++ - boost 链接失败

我正在尝试编译以下代码:#include#include#include#includeintmain(int,char**){namespacebf=boost::filesystem;BOOST_FOREACH(bf::pathpath,boost::make_iterator_range(bf::recursive_directory_iterator(bf::path("/home")),bf::recursive_directory_iterator())){std::cout我的boost库位于/home/foo/include中。并且包含文件确实在那里。当我运行以下命令时

c++ - 为什么 g++ 不链接我创建的动态库?

我一直在尝试制作一些都依赖同一个库的应用程序,动态库是我的第一个想法:所以我开始编写“库”:/*ThinFS.h*/classFileSystem{public:staticvoidcreate_container(stringfile_name);//Createsanewcontainer};/*ThinFS.cpp*/#include"ThinFS.h"voidFileSystem::create_container(stringfile_name){cout然后我编译“库”g++-shared-fPICFileSystem.cpp-oThinFS.o然后我快速编写了一个使用该库

Starrocks扩展FileSystem代码分析

Starrocks扩展FileSystem代码分析Starrocks支持使用FILES()算子对接文件系统例如可以使用insertintofiles("path"="hdfs://xxx.xx.xxx.xx:9000/unload/data1","format"="parquet","compression"="lz4")select*fromsales_records实现将表sales_records中的数据导出到HDFS中,使用parquet格式保存。也可以使用insertintofooselect*fromfiles("path"="hdfs://xxx.xx.xxx.xx:9000/u

Java Hadoop FileSystem 对象到 File 对象

我有一个将文件上传到S3的Java代码示例Filef=newFile("/home/myuser/test");TransferManagertransferManager=newTransferManager(credentials);MultipleFileUploadupload=transferManager.uploadDirectory("mybucket","test_folder",f,true);我实际上想从HDFS上传到S3。我不想做任何复杂的事情,所以我想知道我是否可以使用我已有的代码。那么有没有办法将HadoopFileSystem对象转换为File对象呢?像这