accessing directories using C++

  • Thread starter Casanova http://www.prashanthmohan.tk
  • Start date
C

Casanova http://www.prashanthmohan.tk

Hello

How can i access the directory structure in C++? (I used to use the DIR
structure in C earlier). is there a specialised way to access
directories in C++?

What my requirement is that i want to list the contents of a directory
similar to the ls command in linux. Please tell me how to go abt doing
this.

Thank you in advance
 
J

Jeff Schwab

Casanova said:
Hello

How can i access the directory structure in C++? (I used to use the DIR
structure in C earlier). is there a specialised way to access
directories in C++?

What my requirement is that i want to list the contents of a directory
similar to the ls command in linux. Please tell me how to go abt doing
this.

Thank you in advance

There is no standard library module for interfacing with directory
structures, but there are plenty of good libraries for it. Check out
boost::filesystem, in particular the simple_ls program:

http://www.boost.org/libs/filesystem/example/simple_ls.cpp
 
I

Ioannis Vranos

Casanova said:
Hello

How can i access the directory structure in C++? (I used to use the DIR
structure in C earlier).


Which is not part of the C standard.

is there a specialised way to access
directories in C++?


You will have to use system-specific facilities for this.

What my requirement is that i want to list the contents of a directory
similar to the ls command in linux. Please tell me how to go abt doing
this.


Check some API documentation on the OS you are going to use.
 

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

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,661
Latest member
FloridaHan

Latest Threads

Top