我正在尝试读取我之前成功读取的文件.我正在通过图书馆阅读它,并将其按原样发送到图书馆(即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模板网!
读取输入文件,最快的方法?read input files, fastest way possible?(读取输入文件,最快的方法?)
在 C++ 中读取格式化输入的最简单方法?The easiest way to read formatted input in C++?(在 C++ 中读取格式化输入的最简单方法?)
从 .txt 文件读取到 C++ 中的二维数组Reading from .txt file into two dimensional array in c++(从 .txt 文件读取到 C++ 中的二维数组)
如何在 C++ 中模拟按键按下How to simulate a key press in C++(如何在 C++ 中模拟按键按下)
为什么在 cin.ignore() 之后没有 getline(cin, var) 读取Why doesn#39;t getline(cin, var) after cin.ignore() read the first character of the string?(为什么在 cin.ignore() 之后没有 getline(cin, var) 读取
scanf 格式输入的 cin 类比是什么?What is the cin analougus of scanf formatted input?(scanf 格式输入的 cin 类比是什么?)