#给定一个字符串,比如char *str = /home/magic/DT/improved_trajectory/UCF-101/ApplyEyeMakeup/ApplyEyeMakeup_g01_c01.avi
//我们的任务是得到最后的文件名,而且去掉后缀.avi,然后加上.txt
string path = str;
int p = path.find_last_of("/");
string path_temp = path.substr(p+1); //得到path_temp = ×××××.avi
int q = path_temp.rfind(".avi"); //从后往前找
string path_txt = path_temp.substr(0, q) +".txt"; //得到ApplyEyeMakeup_g01_c01.txt
//另外,附上C的版本
char filename[100]="/home/magic/DT/improved_trajectory/UCF-101/ApplyEyeMakeup/ApplyEyeMakeup_g01_c01.avi";
char *extr=strrchr(filename,'.');
if (extr)
{
*extr='