根据文件路径获取文件名

CString strFileName =m_ strFilePath;//m_ strFilePath是获取到的文件路径;
TCHAR chFileName[ _MAX_FNAME ];
TCHAR chFileExt[ _MAX_EXT ];

_tsplitpath( strFileName.GetBuffer(), NULL, NULL, chFileName, chFileExt );
strFileName.Format( _T("%s%s"), chFileName, chFileExt );
return strFileName;

原文地址:https://www.cnblogs.com/chenzuoyou/p/3077599.html