Solved

os libraries

Posted on 1999-01-10
3
200 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
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 how to create, access, and change arrays in the C programming language.

920 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

16 Experts available now in Live!

Get 1:1 Help Now