How do I write a C program to emulate the Unix LS-L command?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork...
read more
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork failed\n”); exit (-1); } else if ( pid == 0 ) { //child execlp ( “/bin/ls”, “ls”, “-l”, NULL ); //execute ls } else { //parent wait (NULL); //wait for child printf(“\nchild complete\n”); exit (0); } } read less
Comments

#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork...
read more
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <stdlib.h> int main() { int pid; //process id pid = fork(); //create another process if ( pid < 0 ) { //fail printf(“\nFork failed\n”); exit (-1); } else if ( pid == 0 ) { //child execlp ( “/bin/ls”, “ls”, “-l”, NULL ); //execute ls } else { //parent wait (NULL); //wait for child printf(“\nchild complete\n”); exit (0); } } read less
Comments

Related Questions

What is the cost of linux course and how much do the certification cost?
1000 for basic and 2000 for linux advance, for certification, give exam, clear it and you are certified
Anusha
My name is Rajesh , working as a Recruiter from past 6 years and thought to change my career into software (development / admin/ testing ) am seeking for some suggestion which technology I need to learn ? Any job after training ? Or where I can get job within 3 months after finishing my training programme- your advices are highly appreciated
Mr rajesh if you want to enter in to software Choose SAP BW AND SAP HANA because BW and HANA rules the all other erp tools next 50 years.it provides rubust reporting tools for quicker decesion of business It very easy to learn
Rajesh
1 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

how to learn linux system/server adminstration effectively
First the person looking to learn linux adminstration needs to strat from the basic and should practise everyday for atleast 2 hours a day

How To Start Shell Scripting?
Hi learners, I would like to share my knowledge in shell scripting: Every new Linux learners goal is to learn shell scripting. But only a few starts quickly writing the shell scripts.Why? The reasons...

Be prepared to get trained--init
Before starting the training,students must be mentally prepared for acceptance of new knowledge. Students must attend training with open minded forgetting the position they are working.This will help...
S

Smartnub Softsolutions

0 0
0

Introduction to Programming Languages
What is a Programming Language? A programming language is a formal computer language or constructed language designed to communicate instructions to a machine, particularly a computer. Programming languages...

How to detect duplicate address manually in a network from Linux ?
Below script will help you to detect duplicate IP address in a subnet The key command is the arping command which will send out an ARP packet with DAD (duplicate address detection) If the return...

Recommended Articles

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Looking for Linux Training?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you