I want to call opendir()
with the argument of the directory the program is being run from. If possible it will be a platform independent way. I'm confused because the accepted answer to a similar question doesn't look to be platform independent. Other answers say use Boost but a reply to this question states initial_path()
is deprecated. If it can't be done in a platform independent the target is Windows.
问问题
170 次
3 回答
1
initial_path()
已弃用,但它current_path()
在程序开始时有效地为您调用,然后在任何后续调用中返回该结果。因此,您需要做的就是current_path()
在程序开始时调用并将其存储在某个地方。
于 2012-08-15T21:42:07.597 回答
1
这是跨平台的,并告诉您程序的当前工作目录。
char *getcwd(char *buf, size_t 大小);
这是一个 posix 函数,应该在 Linux、OsX 和 Windows 上支持。在这里阅读:
于 2012-08-15T21:34:26.693 回答
0
于 2012-08-15T21:57:28.950 回答