Solved

os libraries

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
voltage to force translation ? 8 99
Understanding the meaning of Portability in Embedded System Programming 8 142
C Language combined operators 28 109
Grammars for C C++ and java 1 122
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…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops 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.

776 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