【问题标题】:How to print the current working directory in Unix shell in C++?如何在 C++ 中打印 Unix shell 中的当前工作目录?
【发布时间】:2017-11-24 22:05:12
【问题描述】:

我在里面使用chdir()方法,所以我不能将cwd定义为字符串。

如何在 C++ 中打印 Unix shell 中的当前工作目录?

【问题讨论】:

    标签: shell c++11 unix operating-system


    【解决方案1】:

    您可以使用 getcwd 函数。或者,如果您坚持使用shell,请使用系统函数执行pwd。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-26
      • 1970-01-01
      • 2011-09-06
      • 2011-03-29
      相关资源
      最近更新 更多