MFC 檔案路徑 檔名操作

2021-08-16 05:41:49 字數 520 閱讀 8874

strfilename=strpathname.mid(strpathname.reversefind( '\\ ')+1); 

//若去掉.txt .exe .doc等字尾,共4個字元

strfilename=strpathname.mid(strpathname.reversefind( '\\ ')+1,strpathname.length()-4); 

cstring   cfiledialog::getpathname(   )   得到完整的檔名,包括目錄名和副檔名如:c:\test\test1.txt   

cstring   cfiledialog::getfilename(   )   得到完整的檔名,包括副檔名如:test1.txt   

cstring   cfiledialog::getextname(   )   得到完整的副檔名,如:txt   

cstring   cfiledialog::getfiletitle   (   )   得到完整的檔名,不包括目錄名和副檔名如:test1

python檔名和檔案路徑操作例項

readme 在日常工作中,我們常常涉及到有關檔名和檔案路徑的操作,在python裡的os標準模組為我們提供了檔案操作的各類函式,本文將分別介紹 獲得當前路徑 獲得當前路徑下的所有檔案和資料夾,刪除檔案 刪除目錄 多個目錄 檢查檔案 檔案路徑 檢查檔案路徑是否存在 分離檔案路徑及檔名 分離副檔名 得...

MFC從檔案路徑獲取檔名和檔案型別

mfc中有時候需要根據獲取的檔案路徑資訊來擷取檔名,或者檔案型別 已知檔案路徑 cstring firstfilepath d wang jw greatwall hexfileencrypt file test sunroof iap 9843 2.hex 1 檔名獲取方式為 cstring fi...

獲取檔名和檔案路徑

1.問題描述 比如已經知道檔案的路徑是 c dir0 dir1 readme.txt 除了用split 的方式獲取檔名和路徑,有沒有什麼更高效的方式 2.解決辦法 os.path.dirname 路徑 os.path.basename 檔名 import os file path d work te...