LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2010, 01:53 AM   #1
vlrk
Member
 
Registered: Dec 2008
Posts: 36

Rep: Reputation: 1
system call to know the files and directories in pwd ( alternative to ls command )


Hello all,

Iam searching for any system call similar to "ls" command we use in shell .

My requirement is knowing the files and directories in curent working directory and process them based on there type .

Here as of now i spawn another procees with system command like system("sh ls -l | grep ^d | awk '{print $9}'").

Instead of this i want to use any system command where i can capture this information directly into my local character buffer.

My opinion is that system calls will not spawn another process as a result less time it takes , another reason is once i use the system command again i need to capture the information to a local file then again read it into local buffer. I want to avoid the file manipulation here .

Hope my reason's of using the system commands are valid , if any body find a relative command that would be really help full for me.


thanks and regards
RK
 
Old 03-03-2010, 07:30 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Which Language is this? Assuming C, start here http://www.scottklement.com/rpg/ifs_ebook/opendir.html
 
1 members found this post helpful.
  


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
intercepting system call / alternative to strace mrshanim Linux - Kernel 2 10-24-2009 10:07 PM
bash: PWD minus last two directories wonderfullyrich Programming 4 09-11-2009 06:32 AM
command and its corresponding system call darwins Linux - Kernel 3 12-25-2008 09:31 AM
Is Mount a system call or shell command? comeon Linux - Software 8 02-21-2005 12:55 AM
how to call a system command with java applet? nickhx Programming 4 08-11-2004 01:46 AM


All times are GMT -5. The time now is 12:02 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration