开发者

Can chdir() accept relative paths?

开发者 https://www.devze.com 2023-02-10 17:20 出处:网络
In C on lin开发者_如何学Cux, can the chdir() function accept a relative path?Yes.The current working directory is a property of the process.

In C on lin开发者_如何学Cux, can the chdir() function accept a relative path?


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


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() is defined to set the current working directory to a pathname.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号