how to read txt files in unknown folders

Z

zl2k

hi, all
I am given a root folder, there are sub-folder and sub-sub-...folders
under the root folders. There are also many txt files at any level of
the folders. How can I automatically visit all those txt files? The
structure of the folder tree is unknown. Thanks for help. I am using
gnu c++.
zl2k
 
R

red floyd

zl2k said:
hi, all
I am given a root folder, there are sub-folder and sub-sub-...folders
under the root folders. There are also many txt files at any level of
the folders. How can I automatically visit all those txt files? The
structure of the folder tree is unknown. Thanks for help. I am using
gnu c++.


ISO/IEC 14882:2003 does not discuss filesystems. You need to ask in a
group dedicated to your platform/OS. Alternatively, Boost may have
something (http://www.boost.org).
 
J

James Kanze

zl2k wrote:
ISO/IEC 14882:2003 does not discuss filesystems. You need to ask in a
group dedicated to your platform/OS. Alternatively, Boost may have
something (http://www.boost.org).

Boost::filesystem has a director_iterator, and a possibility to
ask whether a given path is a directory or not. Given that,
it's trivial to write a recursive function which visits all
sub-directories.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top