如何检查特定路径中的目录,而不是在CWD中
how to check a directory in a particular path not in CWD?
我知道要检查当前目录opendir(dir_name)
,但我需要检查在其他路径中,而不是在CWD(current working directory)
中,
您可以使用opendir(abs_path/dir_name)
打开绝对路径abs_path
下的目录dir_name
。
您也可以使用chdir()
将cwd更改为其他目录
是,守护进程在执行时将其目录更改为root。在执行时更改工作目录的函数是chdir(PATH_TO_SET_AS_CWD)。
相关文章:
- valgrind-hellgrind与泄漏检查的结果不同
- C++模板来检查友元函数的存在
- 检查输入是否不是整数或数字
- 试图让变量检查数组中的某些内容
- 检查值是否在集合p1和p2中,但不在p3中
- C++概念:如何使用'concept'检查模板化结构的属性?
- 概念TS检查忽略私有访问修饰符
- 检查 std::shared_ptr<> 的当前底层类型是否为 T
- 在c++中检查长方体是否尽可能快地重叠(无迭代)
- 如何在C++中检查2D数组中负值的输入验证
- C++:正在检查LinkedList中的回文-递归方法-错误
- 使用for循环检查数组中的重复项
- 如何检查一个c++字符串中有多少相同的字符/数字
- 检查不带转换的扫描格式
- 如何检查线程是否锁定
- 清除前检查矢量
- 如何处理来自核心指南检查器的关于gsl::at的静态分析警告
- C++LDAP检查用户是否是特定组的成员
- 检查TCHAR数组输入是否为带符号整数C++
- 如何检查特定路径中的目录,而不是在CWD中