C 找資料夾中,最長的名字有多長

2021-10-24 13:21:44 字數 812 閱讀 6307

// testforonlyc++.cpp : 定義控制台應用程式的入口點。

//#include

"stdafx.h"

#include

#include

#include

#include

#include

#include

#include

using

namespace std;

typedef std::vector stringlist;

/*分割字串

*/stringlist splitstr

(const std::string& str,

char tag)

}else

//將i位置的字元放入子串}if

(!substr.

empty()

)//剩餘的子串作為最後的子字串

return li;

}void

getallfiles

(string path, vector

& files)

}else

//檔案處理

}while

(_findnext

(hfile,

&fileinfo)==0

);//尋找下乙個,成功返回0,否則-1

_findclose

(hfile);}

}//測試

intmain()

}//cout << "max="<

return0;

}

刪除有檔案的資料夾

含有檔案的資料夾用delete 方法是不能刪的!delete 只能刪除檔案和空的資料夾!因此要想刪除含有檔案的資料夾,你只能用遞迴的方法進行判斷和刪除!public boolean deletefile string delpath throws filenotfoundexception,ioex...

bat獲取資料夾內所有檔案的名字

一 最近想要獲取資料夾內所有檔案的名稱,但是乙個個的複製太麻煩了,所以決定寫個指令碼自動獲取。echo off 獲取對應路徑下檔名,dir 路徑 b a.txt pause二 命令 顯示目錄中的檔案和子目錄列表。dir drive path filename a attributes b c d l...

SVN 刪除所有同名字的資料夾

當使用了svn版本控制系統後每個目錄下都會有乙個.svn目錄存在,開發完當交付產品或者上傳到伺服器時一般要把這些目錄刪除,這裡總結了一下在linux和win下的辦法。一 在linux下 刪除這些目錄是很簡單的,命令如下 find type d name svn xargs rm rf 或者find ...