Find all file in a directory

A

Abhijit

Hello everybody,

I tried to find the files in a directory. The search should also
include the files in the sub directory as well. Is there anything
built in to find the files in c ? I don't want to use any system calls
(UNIX).

Any pointers would be highly appreciated
 
S

Sharad Kala

Abhijit said:
Hello everybody,

I tried to find the files in a directory. The search should also
include the files in the sub directory as well. Is there anything
built in to find the files in c ? I don't want to use any system calls
(UNIX).

Not in Standard C++. Take a look at Boost's filesystem library.

Sharad
 
G

Gernot Frisch

Abhijit said:
Hello everybody,

I tried to find the files in a directory. The search should also
include the files in the sub directory as well. Is there anything
built in to find the files in c ? I don't want to use any system
calls
(UNIX).

This is a OS specific question. On Win use FindFirstFile/FindNextFile
and on *NIX use functions from dirent.h.

If you don't want to use these, you can calculate names with brute
force algorithm and try for their existence with fopen... <Just a
joke>

HTH,
Gernot
 
R

Richard Herring

Abhijit said:
Hello everybody,

I tried to find the files in a directory. The search should also
include the files in the sub directory as well. Is there anything
built in to find the files in c ?

Nothing. Nor in C++, which I assume is what you really meant, given the
newsgroup name.
I don't want to use any system calls
(UNIX).

Unfortunately, you have no choice - except that the Boost Filesystem
Library might supply what you need.
Any pointers would be highly appreciated

http://www.boost.org/libs/filesystem/doc/index.htm
 

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,176
Messages
2,570,950
Members
47,501
Latest member
log5Sshell/alfa5

Latest Threads

Top