Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个目录路径,其中有第二个挂载的 fs 作为完整路径的一部分。
如果我使用getcwd它返回第二个挂载文件系统的绝对路径,而不是所有应用程序配置所需的相对路径。
getcwd
当我查看pwd代码时,它显示了xgetcwd哪些调用getcwd。目前尚不清楚如何:
pwd
xgetcwd
首先使用以下方法获取绝对路径:
char abspath[256] = ""; getcwd(abspath, 256);
然后使用以下方法获取相对路径:
strrchr(abspath, '/');