Solved

os libraries

Posted on 1999-01-10
3
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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 recursion 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.

734 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