Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

os libraries

Posted on 1999-01-10
3
Medium Priority
?
207 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 600 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

Technology Partners: 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

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Suggested Courses

963 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