MFC - 获取程序当前路径

 1 //
 2 //    函数        --        GetAppPath()
 3 //
 4 //    功能        --        获取程序的当前路径(路径中带"\\", 不含执行文件名称"\\xx.exe")
 5 //
 6 //    注释        --        
 7 //                         <1>. #include <direct.h>
 8 //                         <2>. _getcwd();                    获取程序当前路径
 9 //
10 CString GetAppPath()
11 {   
14     char szPath[100];
15     ZeroMemory(szPath, 100);
16     _getcwd(szPath, 100);
17     CString strPathName(szPath);
19     return strPathName;
20 }

 

posted @ 2016-05-01 21:03  C/C++/Python/Java  阅读(818)  评论(0编辑  收藏  举报