LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-08-2005, 11:08 AM   #1
rajsun
Member
 
Registered: Mar 2005
Posts: 61

Rep: Reputation: 15
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
 
Old 06-08-2005, 11:26 AM   #2
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
Why are you trying to reinvent find or ls?
 
Old 06-08-2005, 11:27 AM   #3
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
rajsun: Use the opendir() function to read the files in a directory.
 
Old 06-09-2005, 05:03 PM   #4
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
opendir()
sacndir()
closedir()

.. see dirent.h
 
Old 06-10-2005, 12:47 AM   #5
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
You can also look here:

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

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
awk: fatal:cannot open file for reading (no such file or Directory) in Linux sangati vishwanath Linux - Software 4 07-06-2005 12:59 AM
SSL Install not going well. Linux server, Apache directions? File names not matching. maineweb Linux - Newbie 1 11-18-2004 09:18 AM
monitoring directory to get the modified file names appas Programming 1 09-06-2004 04:56 AM
view long file names from windows in linux wildcat22 Linux - General 4 09-03-2004 04:14 PM
Windows file names in Linux console mbegovic Linux - General 4 04-30-2004 01:09 AM


All times are GMT -5. The time now is 07:03 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration