如何在路径规格中工作两个点
How do two dots in work in path specifications
在此示例中
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
int main()
{
fs::path p = fs::path("..") / ".." / "AppData";//What is it?
std::cout << "Current path is " << fs::current_path() << 'n'
<< "Canonical path for " << p << " is " << fs::canonical(p) << 'n';
}
什么是".."
,它如何工作?
..是父目录,如果您在/home/user/kat中,然后转到..您将在/home/user中。
例如,这样的代码:
fs::path parentPath = fs::current_path() / "..";
std::cout << parentPath << " → " << fs::canonical(parentPath) << std::endl;
将产生此输出(在我的PC上):
"/home/kamil/Pulpit/build/.." → "/home/kamil/Pulpit"
相关文章:
- C++控制台应用,其中有两个冲突的对象不工作
- 我的解码程序的两个部分没有按预期工作
- 给定的两个代码有什么区别.一个在 ideone 上运行时超出时间限制,另一个工作正常
- 使用两个命名空间只能部分工作
- 在循环工作时,首先将两个文件读为向量,但仅次于迭代一次
- OpenGL Ping Pong可与一张通行证一起工作,而不是两个通行证
- 两个超载的STD ::前进工作如何
- 除了两个构造函数外,C++库导入也可以工作
- 在打印出动态分配的数组中的前两个数字时遇到问题,其他数字工作正常
- 如何使其工作,两个类的问题
- 如何在路径规格中工作两个点
- 具有两个OpenGL图形视图的MFC MDI拆分器无法工作
- 逗号(,)在条件部分中两个表达式之间的for循环中的工作方式
- 提升:两个工作线程,使主线程休眠,直到它们都完成
- C++模需要在两个*无*符号字节之间进行减法转换才能工作,为什么
- 具有相同名称和不同模板参数的两个结构如何工作
- 两个双精度值的 C++ 比较无法正常工作
- 当两个不同的参数中有空格时,C++系统()不工作
- 如何使这两个模板类协同工作?(C++中的属性)
- 通过使用两个凸壳的切线来合并它们的算法在实践中是如何工作的