VC 获取可执行文件的路径
2010-12-16 13:04
211 查看
c语言获取可执行文件路径
#include<direct.h>
char path[1024] = {0};
getcwd(path,sizeof(path));
获取exe文件的路径,并且将.exe的文件名替换成新的文件名
1、通过GetModuleFileName
CString filePath;
GetModuleFileName(NULL,filePath.GetBuffer(Max_PATH),MAX_PATH);
filePath.ReleaseBuffer();//获取带.exe文件名的路径
filePath=filePath.Left(filePath.ReverseFind('//')); //注意是单引号
//用双引号会报错(希望有人能解答下)
filePath+=_T("//新的文件名");
CString CProcess::GetExePath()
{
CString filePath;
GetModuleFileName(NULL,filePath.GetBuffer(255),MAX_PATH);
filePath.ReleaseBuffer();//获取带.exe文件名的路径
filePath = filePath.Left(filePath.ReverseFind('//'));
filePath += _T("//");
return filePath;
}
2、
CString filePath;
filePath=theApp.m_pszHelpFilePath;
filePath=filePath.Left(filePath.ReverseFind( '// '));
filePath+= _T("// ");
#include<direct.h>
char path[1024] = {0};
getcwd(path,sizeof(path));
获取exe文件的路径,并且将.exe的文件名替换成新的文件名
1、通过GetModuleFileName
CString filePath;
GetModuleFileName(NULL,filePath.GetBuffer(Max_PATH),MAX_PATH);
filePath.ReleaseBuffer();//获取带.exe文件名的路径
filePath=filePath.Left(filePath.ReverseFind('//')); //注意是单引号
//用双引号会报错(希望有人能解答下)
filePath+=_T("//新的文件名");
CString CProcess::GetExePath()
{
CString filePath;
GetModuleFileName(NULL,filePath.GetBuffer(255),MAX_PATH);
filePath.ReleaseBuffer();//获取带.exe文件名的路径
filePath = filePath.Left(filePath.ReverseFind('//'));
filePath += _T("//");
return filePath;
}
2、
CString filePath;
filePath=theApp.m_pszHelpFilePath;
filePath=filePath.Left(filePath.ReverseFind( '// '));
filePath+= _T("// ");
相关文章推荐
- vc获取可执行文件的路径
- VC获取可执行文件路径
- Cron 的在ubuntu 定时执行自己的程序&& Python获取当前 脚本文件的路径。
- VC从文件全路径中获取文件名和扩展名方法
- delphi 获取可执行文件的当前路径
- 【转】VC中获取文件的相对路径和绝对路径
- delphi 获取可执行文件的当前路径
- vc获取执行文件的目录
- 获取当前正在执行的服务器应用程序根目录的物理文件系统路径
- 获取可执行文件的当前路径
- VC从文件全路径中获取文件名和扩展名方法
- Ruby 获取当前执行文件所在路径 ; ruby获取当前路径
- 获取当前正在执行的服务器应用程序根目录的物理文件系统路径
- vc 获取程序版本号,当前程序路径,文件修改时间 等
- MFC 获取当前工作路径和可执行文件路径
- VC中获取文件路径
- VC获取当前程序文件的路径,文件名以及路径+文件名
- VC获取执行程序路径
- VC执行批处理文件并获取结果输出到RichEdit控件
- VC/MFC 设置程序与文件关联与双击文件获取文件路径