Link to home
Start Free TrialLog in
Avatar of bass20
bass20

asked on

Manipulating Directories

Hello!
How can I manipulate directories in C (create, delete, search for, etc...) without using system("")?

Thanx!
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bass20
bass20

ASKER

Thanx, but what should I use if I need to count how many files are in a directory?
To count the number of files (and not sub directories)
you need to

opendir()
then use scandir/readdir to scan the directory
for each entry do a stat()
determine the type of entry (file/special file/fifo/device/directory/link)
if file then increment count