VC 中如何从字符串中分离文件名与路径+路径操作
来源:互联网 发布:linux 分区命令 编辑:程序博客网 时间:2024/06/11 13:33
#include "stdafx.h"
#include "PathStringManager.h"
CPathStringOper::CPathStringOper(void)
{
}
CPathStringOper::~CPathStringOper(void)
{
}
CPathStringOper::GetFolderPathFromFullPath(LPCTSTR lpszFullPath)
{
// 获取文件路径:
// 注意不是“/”以结尾,因为使用过程中加上一个“/”容易,减去一个不容易
CString m_strOriFileName(lpszFullPath);
CString strPath;
int n=m_strOriFileName.ReverseFind('//')+1;
strPath=m_strOriFileName.Left(n);
return strPath;
}
CPathStringOper::GetFileFullNameFromFullPath(LPCTSTR lpszFullPath)
{
// 获取文件名:
CString m_strOriFileName(lpszFullPath);
CString strPath;
int n=m_strOriFileName.GetLength()-m_strOriFileName.ReverseFind('//')-1;
strPath=m_strOriFileName.Right(n);
return strPath;
}
CPathStringOper::GetFileExtNameFromFullPath(LPCTSTR lpszFullPath)
{
// 同理,获取文件后缀名则为:
CString m_strOriFileName(lpszFullPath);
CString strFileType;
int n=m_strOriFileName.GetLength()-m_strOriFileName.ReverseFind('.')-1;
strFileType=m_strOriFileName.Right(n);
return strFileType;
}
>>> 后来发现Windows 本身就能,就提供API实现,
不过 GetFolderPathFromFullPath(LPCTSTR lpszFullPath),GetFileExtNameFromFullPath(LPCTSTR lpszFullPath) API没有
Common Dialog Box Functions
The following functions are used with common dialog boxes.
The following functions are used with common dialog boxes.
ChooseColor
ChooseFont
CommDlgExtendedError
FindText
GetFileTitle
GetOpenFileName
GetSaveFileName
PageSetupDlg
PrintDlg
PrintDlgEx
ReplaceText
short GetFileTitle(
LPCTSTR lpszFile, // pointer to full path and filename for file
LPTSTR lpszTitle, // pointer to buffer that receives filename
WORD cbBuf // length of buffer
);
BOOL GetOpenFileName(
LPOPENFILENAME lpofn // address of structure with initialization
// data
);
- VC 中如何从字符串中分离文件名与路径+路径操作
- VC 中如何从字符串中分离文件名与路径
- VC 中如何从字符串中分离文件名与路径(CString)
- [C语言(VC)] 从路径字符串中分离出文件名
- 如何从完整的文件路径中分离文件名和路径名?
- linux c下,从路径名中分离文件名
- linux shell从带路径的字符串中获取文件名
- linux shell从带路径的字符串中获取文件名
- 从字符串中分离磁盘符号,路径,及文件名称
- VC 中如何从字符串中分离文件…
- VB如何从文件路径名中获得文件名?
- 如何从文件路径中得到文件名及其扩展名
- Android--从路径中提取文件名
- 从完整路径中获取文件名
- 从路径名中得到文件名 MFC
- Android 从路径中获取文件名
- Android 从路径中提取文件名
- C++从路径中提取文件名
- 话说如何解决拥有百千万用户网站压力问题的架
- Box2DFlash物理引擎的使用方法
- 【题目36】百度的一道面试题-找到攻击IP
- Windows server 2008系统优化
- 使用Delphi快速开发ActiveX控件
- VC 中如何从字符串中分离文件名与路径+路径操作
- 《windows内核情景分析》句柄和句柄表
- socket 编程时遇到的出错码解析
- javascript中的prototype方法使用说明(详解)
- 用C语言创建多级目录
- 【linux命令】sort技巧
- 开博
- 安装飞信fetion IE主页被yidong139篡改
- DSP学习体会