LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Getting file names in a directory using C on linux. (http://www.linuxquestions.org/questions/programming-9/getting-file-names-in-a-directory-using-c-on-linux-331568/)

rajsun 06-08-2005 11:08 AM

Getting file names in a directory using C on linux.
 
Hi All,

I need a small program using C to get all file names in a specified directory in linux by giving file type as input (like *.c or *.so).


Thanks in advance,
Suresh B

rstewart 06-08-2005 11:26 AM

Why are you trying to reinvent find or ls?

Matir 06-08-2005 11:27 AM

rajsun: Use the opendir() function to read the files in a directory.

jim mcnamara 06-09-2005 05:03 PM

opendir()
sacndir()
closedir()

.. see dirent.h

enemorales 06-10-2005 12:47 AM

You can also look here:

http://www.linuxquestions.org/questi...hreadid=331944

It's another thread in the same forum, but related to processes...


All times are GMT -5. The time now is 05:06 PM.