我正在尝试读取我之前成功读取的文件.我正在通过图书馆阅读它,并将其按原样发送到图书馆(即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?
既然你添加了 Visual-c++ 标签,我将建议使用标准的 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);
这篇关于如何找到当前目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!