lit*_*tuk 15 c++ visual-studio
我想将当前目录设置为解决方案diretory /配置名称.我怎么做?我可以用某种方式使用全局变量吗?
编辑:我正在尝试读取文件,当前目录在代码中间发生变化.我想改回来.
rtu*_*ado 39
在Visual Studio 2010中:
$(SolutionDir)$(Configuration)\.您可以使用 posix 子系统 ( <direct.h>) 并访问功能
_getcwd()/_wgetcwd()获取当前工作目录
_chdir()/_wchdir()设置当前工作目录
如果您需要跨平台的代码,您可以执行以下操作:
#ifdef _WIN32
# include <direct.h>
# define getcwd _getcwd
# define chdir _chrdir
#else
# include <unistd.h>
#endif
Run Code Online (Sandbox Code Playgroud)
并使用getcwd和chdir(不带前导下划线)。
| 归档时间: |
|
| 查看次数: |
59672 次 |
| 最近记录: |