Handling directories with C++

J

Jamie Vicary

Dear all,

Despite a good few hours of googling, I have been unable to find out
what the standard C++ libraries are for handling directories and getting
a list of the files inside them.

I am using the mingw c++ compiler on a windows machine to write a
console application. system("mkdir blah") calls aren't what I need
because I need return values to check for things going wrong.

It's the sort of thing that's easy if you know the answer, but
impossible if you don't...

Thanks,

Jamie
 
R

Rolf Magnus

Jamie said:
Dear all,

Despite a good few hours of googling, I have been unable to find out
what the standard C++ libraries are for handling directories and
getting a list of the files inside them.

C++ only has one standard library, and that doesn't provide any
functionality for directory handling.
I am using the mingw c++ compiler on a windows machine to write a
console application. system("mkdir blah") calls aren't what I need
because I need return values to check for things going wrong.

It's the sort of thing that's easy if you know the answer, but
impossible if you don't...

You have to use system-specific functions, or maybe boost helps.
 
J

JKop

Jamie Vicary posted:
Dear all,

Despite a good few hours of googling, I have been unable to find out
what the standard C++ libraries are for handling directories and getting
a list of the files inside them.

I am using the mingw c++ compiler on a windows machine to write a
console application. system("mkdir blah") calls aren't what I need
because I need return values to check for things going wrong.

It's the sort of thing that's easy if you know the answer, but
impossible if you don't...

Thanks,

Jamie

On Windows:

FindFirstFileEx
FindNextFileEx
FindClose


-JKop
 
J

Jeff Flinn

Jamie Vicary said:
Dear all,

Despite a good few hours of googling, I have been unable to find out
what the standard C++ libraries are for handling directories and getting
a list of the files inside them.

I am using the mingw c++ compiler on a windows machine to write a
console application. system("mkdir blah") calls aren't what I need
because I need return values to check for things going wrong.

It's the sort of thing that's easy if you know the answer, but
impossible if you don't...


See http://www.boost.org/libs/filesystem/doc/index.htm for a portable, and
IMHO, the best solution.

Jeff F
 

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
474,175
Messages
2,570,942
Members
47,489
Latest member
BrigidaD91

Latest Threads

Top