程序運行沒問題。
但是我有個疑問。。見圖:
我是用了FindFirstFile()和FindNextFile()遍歷所有文件夾,上圖是我讀取的路徑,裡面有兩個文件夾,一個默認,一個新建,但是我發現讀取時FindFirstFile()讀取的先是新建的文件夾名稱,然後才是默認的文件夾,難道不應該先讀取默認文件夾嗎?
求解惑啊。。
https://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx 上面的Remark寫了原因:
The FindFirstFile function opens a search handle and returns information about the first file that the file system finds with a name that matches the specified pattern. This may or may not be the first file or directory that appears in a directory-listing application (such as the dir command) when given the same file name string pattern. This is because FindFirstFile does no sorting of the search results.
FindFirstFile找到的文件和文件/文件夾顯示的順序不一定一樣的,因為其對找到的結果不進行排序。