How can I interact with directories in C++?
Is th开发者_StackOverflowe C++ language dealing with directories like create, delete, get directory content, search, etc.
Does C++ have an internal library or are there external libraries ?
Is there a recommended library?
Boost.Filesystem is what you want:
The Boost.Filesystem library provides facilities to manipulate files and directories, and the paths that identify them.
Libraries that support this:
- Boost Filesystem
- Qt
- PoCo
Boost Filesystem is a library that will in some shape or form most likely end up in a TRn library (Standard Technical Report library sepcification):
File System.
A standard file system library provides portable facilities to query and manipulate paths, files, and directories. It will enable C++ programmers to perform portable script-like operations from within C++ programs. The Boost.Filesystem library (which you can download and install individually) was proposed as a candidate for Technical Report 2. I believe that there's a wide consensus about the necessity of a standard file system library in C++. However, such a library will not be part of C++0x because the committee is now focusing on finalizing the Committee Draft, which leaves little room for adding new libraries. A file system library will probably ship as a separate TR.
The QT library also has cross platform support for file and directory manipulation.
See:
- http://qt.nokia.com/
- http://doc.trolltech.com/4.6/io.html
精彩评论