string strTemp=strDirPath+"\\*.*";//添加通配符
CFileFind finder;
BOOL bWorking=finder.FindFile(strTemp.c_str());//打开目录准备文件查找
while (bWorking)
{
bWorking=finder.FindNextFile();//查找文件
CString filename=finder.GetFileName();//获取文件名称
CString strExt=filename.Right(filename.GetLength()-filename.ReverseFind('.')-1);
//strExt 文件后缀
}
、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
CString strExt=filename.Right(filename.GetLength()-filename.ReverseFind('.')-1);
返回此CString对象中与要求的字符匹配的最后一个字符的索引;如果没有找到需要的字符则返回-1。
例如:luckly.txt
'.' 在第三位
Right 去掉左边的数据