如何将工作目录设置为“解决方案目录”在c ++ [英] How do i set the working directory to the "solution directory" in c++

查看:107
本文介绍了如何将工作目录设置为“解决方案目录”在c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将当前目录设置为解决方案目录/配置名称。
我该怎么做?
我可以以某种方式使用全局变量吗?

I want to set the current directory to the solution diretory/configuration name. how do i do that? can i use the global variables somehow?

非常感谢,
Lean

thanks a lot, Lean

编辑:我试图读取一个文件和当前目录在代码中间更改。

edit: i am trying to read a file and the current directory changes in the middle of the code. i want to change it back.

推荐答案

如果当前目录正在更改,您应该在启动时保存您的工作目录变量你可以访问以后设置cwd回到那里。至少这是我理解你的问题。

If your current directory is changing, you should probably save your working directory at startup in some variable you can access later to set cwd back there. At least this is how I understand your question.

为了获得cwd,可能有帮助。

For getting the cwd, this might help.

这篇关于如何将工作目录设置为“解决方案目录”在c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆