468,511 Members | 1,641 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,511 developers. It's quick & easy.

accessing directories using C++

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

Jul 23 '05 #1
2 1211
Casanova http://www.prashanthmohan.tk wrote:
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.../simple_ls.cpp
Jul 23 '05 #2
Casanova http://www.prashanthmohan.tk wrote:
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.

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by R. Readi | last post: by
reply views Thread by Dave Friedel | last post: by
6 posts views Thread by =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.