VC从文件全路径中获取文件名和扩展名方法
来源:互联网 发布:股票虚拟盘软件 编辑:程序博客网 时间:2024/05/02 00:51
方法一:CString CPrintImage::GetFileTitleFromFileName(CString FileName,CString& ExtendName) //获取文件名和扩展名{ int Where; Where=FileName.ReverseFind('//'); if(Where==-1) { Where=FileName.ReverseFind('/'); } CString FileTitle=FileName.Right(FileName.GetLength()-1-Where); int Which=FileTitle.ReverseFind('.'); ExtendName=FileTitle.Right(FileTitle.GetLength()-Which-1); if (Which!=-1) { FileTitle=FileTitle.Left(Which); } return FileTitle;}调用方法:CString a,b,c;a="c://kele8//shootman2//vision//123.exe";b=this->GetFileTitleFromFileName(a,c);AfxMessageBox(b); //弹出123.exeAfxMessageBox(c); //弹出exe 方法二:CString CPrintImage::GetFileTitleFromFileName(CString FileName, BOOL Ext) { int Where; Where = FileName.ReverseFind('//'); if (Where == -1) Where = FileName.ReverseFind('/'); CString FileTitle = FileName.Right(FileName.GetLength() - 1 - Where); if (!Ext) { int Which = FileTitle.ReverseFind('.'); if (Which != -1) FileTitle = FileTitle.Left(Which); } return FileTitle; } 调用方法:CString a,b,c;a="c://kele8//shootman2//vision//123.exe";b=this->GetFileTitleFromFileName(a,TRUE);c=this->GetFileTitleFromFileName(a,FALSE);AfxMessageBox(b); 弹出123.exeAfxMessageBox(c); 弹出123
原文地址:http://blog.csdn.net/degree_37/article/details/5506674
0 0
- VC从文件全路径中获取文件名和扩展名方法(CString)
- VC从文件全路径中获取文件名和扩展名方法(CString)
- VC从文件全路径中获取文件名和扩展名方法
- VC从文件全路径中获取文件名和扩展名方法(CString)
- VC从文件全路径中获取文件名和扩展名方法
- VC从文件全路径中获取文件名和扩展名方法
- VC获取从文件路径中返回文件名和扩展名两个参数
- VC++ 从 CString类型的文件路径中获取文件名和扩展名
- 解析文件路径,获取文件名和扩展名
- 获取文件路径 文件名 文件的扩展名的方法
- C# 从路径中获取文件名及其扩展名
- VC获取当前程序文件的路径、文件名、全文件名
- 如何从文件路径中得到文件名及其扩展名
- Delphi获取文件名、文件名不带扩展名、文件名的方法;delphi 获取文件所在路径
- C/C++ 解析文件路径 获取文件名和扩展名
- 获取url文件名和扩展名及服务器路径的方法
- 从文件路径中获取文件名的方法
- C#路径中获取文件全路径、目录、扩展名、文件名称
- Unity协程(Coroutine)原理深入剖析
- leetcode 22:Generate Parentheses(15-10-9)
- 1011. World Cup Betting
- 【动态规划】0-1背包问题
- Ubuntu14.04中fcitx-rime中州韵输入法安装设置
- VC从文件全路径中获取文件名和扩展名方法
- 类装载器体系结构
- 操作系统——pv操作示例
- MYSQL -- case when用法
- 编写测试用例时用到黑盒测试的方法
- Java 和Java虚拟机的关系
- iOS判断手机是否有网的方法
- 在eclipse中集成SVN插件
- 我的第一篇博客