hari
hari

Reputation: 9733

list all files with a paticular extension of a dir in C

In C, can I list all files with certain extension inside a dir?

Any api available?

"ls" would be the last thing I want to do.

Thanks in advance.

Upvotes: 2

Views: 141

Answers (1)

derobert
derobert

Reputation: 51157

On UNIX, you're looking for opendir and readdir (and maybe fnmatch) or alternatively glob (which puts those three together for you). These are not part of C, but rather POSIX.

Upvotes: 7

Related Questions