471,047 Members | 1,237 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,047 software developers and data experts.

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 1252
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.