程序中经常要读取自身应用所在目录,用于读取配置文件等,这里介绍一种方法:
CString strINIFilePath; GetModuleFileName(NULL,strINIFilePath.GetBuffer(MAX_PATH),MAX_PATH); strINIFilePath.ReleaseBuffer(); CString path = strINIFilePath.Left(strINIFilePath.ReverseFind('\\') + 1);
程序中经常要读取自身应用所在目录,用于读取配置文件等,这里介绍一种方法:
CString strINIFilePath; GetModuleFileName(NULL,strINIFilePath.GetBuffer(MAX_PATH),MAX_PATH); strINIFilePath.ReleaseBuffer(); CString path = strINIFilePath.Left(strINIFilePath.ReverseFind('\\') + 1);
转载于:https://www.cnblogs.com/99code/p/5683818.html