如何查找当前目录? [英] How do I find the current directory?
本文介绍了如何查找当前目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试读取我先前读取的档案。
我正在通过库读取它,我把它原样发送到库(即myfile.txt)。
我知道该文件是从工作/当前目录中读取的。
I am trying to read a file which I read previously successfully. I am reading it through a library, and I am sending it as-is to the library (i.e. "myfile.txt"). I know that the file is read from the working/current directory.
我怀疑当前/工作目录已经以某种方式改变了。
如何检查当前/工作目录是什么?
I suspect that the current/working directory has changed somehow. How do i check what is the current/working directory?
推荐答案
'm去建议标准的windows函数来做。 GetCurrentDirectory
Since you added the visual-c++ tag I'm going to suggest the standard windows function to do it. GetCurrentDirectory
用法:
TCHAR pwd[MAX_PATH];
GetCurrentDirectory(MAX_PATH,pwd);
MessageBox(NULL,pwd,pwd,0);
这篇关于如何查找当前目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文