Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么下面的代码不打印调用程序的路径名?
#include<iostream> int main() { TCHAR buffer[MAX_PATH]; GetModuleFileName(NULL,buffer,sizeof(buffer)); cout << "Filepath:" << buffer << "\n"; }
感谢大家的帮助,问题出在 cout 上,我使用了 wprintf 并且它有效..
可能是您看不到缓冲区的内容(因为应用程序死掉了),但缓冲区实际上包含您期望的数据?