2
A
回答
3
例如:
class CARPETAS
creation
make
feature {NONE}
make is
local
directory: DIRECTORY
path: STRING
do
path := "." -- Current directory
!!directory.scan_with(path)
list_directory(directory)
end
list_directory(directory: DIRECTORY) is
local
i: INTEGER
do
std_output.put_string("Content of " + directory.path + "%N")
from
i := directory.lower
until
i > directory.upper
loop
std_output.put_string("%T" + directory.name(i) + "%N")
i := i + 1
end
end
end
2
與最新版本的艾菲爾的,我會建議使用DIRECTORY.entries
local
p: PATH
do
across dir.entries as ic loop
p := ic.item.path
-- then use interface of PATH, such as PATH.name
end
end
注意,base_extension庫還提供DIRECTORY_VISITOR,這是有幫助的遞歸迭代對目錄
相關問題
- 1. 在艾菲爾
- 2. 如何在艾菲爾
- 3. 學習艾菲爾的經驗
- 4. 如何遍歷目錄中的文件?
- 5. 如何遍歷Common Lisp中的目錄?
- 6. 如何遍歷Ant中的目錄
- 7. 遍歷目錄
- 8. 遍歷目錄樹
- 9. R:遍歷目錄
- 10. 如何遍歷並獲取SQL Server目錄中的子目錄?
- 11. 誤差/如果Statment在自由ISE艾菲爾
- 12. 與艾菲爾的關鍵字「like`不變的分享
- 13. 如何使用線程遍歷目錄?
- 14. 目錄遍歷攻擊
- 15. 用php遍歷目錄?
- 16. 通過http遍歷目錄
- 17. Unix:遍歷一個目錄
- 18. 目錄遍歷bash shell
- 19. 遍歷目錄路徑
- 20. 艾菲爾:擴展類型是否符合ANY?
- 21. 目錄遍歷在java中的擴展
- 22. c中的迭代目錄遍歷
- 23. 如何遍歷目錄和cd到每個目錄
- 24. 如何遍歷Java中目錄中的文件?
- 25. 如何在Android中遍歷/ proc目錄中的APK
- 26. 如何遍歷c#.net中目錄中的所有文件?
- 27. 如何遍歷MongoDB 3.0中的條目?
- 28. 如何遍歷RibbonPageGroup中的DevExpress項目?
- 29. 在bash中遍歷子目錄
- 30. 如何遍歷bash腳本中的子目錄?
與最近版本的艾菲爾,我會推薦使用DIRECTORY.entries
local p: PATH do across dir.entries as ic loop p := ic.item.path -- then use interface of PATH, such as PATH.name end end
– Jocelyn 2014-01-09 13:30:58