chdir()可以接受相对路径吗? [英] Can chdir() accept relative paths?

查看:159
本文介绍了chdir()可以接受相对路径吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上的C语言中,chdir()函数可以接受相对路径吗?

In C on linux, can the chdir() function accept a relative path?

推荐答案

是.当前工作目录是该进程的属性.

Yes. The current working directory is a property of the process.

稍微扩展一下-以下是几个相关的 POSIX 定义:

To expand on that a little - here are a couple of the relevant POSIX definitions:

  • 当前工作目录定义为与进程关联的目录,在路径名解析中用于不以斜杠字符开头的路径名"(在

  • The current working directory is defined as "a directory, associated with a process, that is used in pathname resolution for pathnames that do not begin with a slash character" (there is more detail in the section on pathname resolution).

chdir() 定义为设置当前工作目录中的路径名.

chdir() is defined to set the current working directory to a pathname.

似乎有些循环,但是在参数chdir()的上下文中,路径名"没有什么特别之处;照常使用路径名解析.

It seems somewhat circular, but there is nothing special about a "pathname" in the context of the argument chdir(); it is subject to pathname resolution as normal.

这篇关于chdir()可以接受相对路径吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆