从路径中分离文件名:

CString GetFileName(CString pathname) 

for( int i=pathname.GetLength()-1; i>=0; i-- ) 

if( pathname[i]=='\\' ) 
break; 

return pathname.Mid( i+1 ); 
}
从路径中分离路径名(去除文件名):

CString GetPath(CString pathname) 

int i = 0, j; 
while( i<pathname.GetLength() ) 

if( pathname[i]=='\\' ) 
j = i; 
i++; 

return pathname.Left( j+1 ); 
}

相关文章:

  • 2022-12-23
  • 2021-10-12
  • 2021-09-25
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-10-08
  • 2022-01-01
猜你喜欢
  • 2021-11-05
  • 2021-09-26
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案