Solved

os libraries

Posted on 1999-01-10
3
199 Views
Last Modified: 2010-04-15
I want to know if any C libraries are available online that provide functions for performing UNIX commands. For eg. supposing I want to find a file in UNIX, i want to do it thru a C program by calling a function called find() and supplying the same parameters as in find command.
0
Comment
Question by:rajukv
  • 2
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1255735
I don't know such a library, but it's simple too

   char *cmd = "/usr/bin/find start_path -name your-pattern -print";
   int   err = 0;
  err = system( cmd );

Or, if you want to process the result:

   FILE *fid = (FILE *)NULL;
   fid = popen(  cmd, "r" );
   while (fscanf( fid, ... ) != EOF) {
       /* your action here */
   }
 
0
 
LVL 2

Accepted Solution

by:
hougaard earned 200 total points
ID: 1255736
1. In Linux you have the source for most Unix commands
2. The Standard C library will give basic functionallity. (like findfirst/Findnext etc)
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1255737
rajukv, could you please explain your grading.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now