Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

c program to implement the unix or linux command to
implement
ls -l >output.txt

Answer Posted / rahul magdum

#include sys/types.h
#include unistd.h
#include sys/stat.h

main()
{
Int pid=fork();
Int fd=creat("op.txt",S_IRWXU);
If(pid!=0 && pid!=-1)
{
close(1); // stdout
dup(fd); // replace file descriptor
execlp("ls","ls","-l",null);
close(fd);

}
}

Is This Answer Correct ?    22 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between command and utility in unix?

911


The very first process created by the kernel in unix is?

818


How to protect a process from others to kill?

910


What are the possible return values of kill() system call?

808


Explain c program to implement the unix or linux command to implement ls -l >output.txt?

795


Tell me how to protect a process from others to kill?

800


What is the first process created by the kernel in unix?

829


Name the command which is used to execute system calls from exe?

903


What is the difference between command and utility in unix?

889


Explain the mount system calls?

907


Explain the mount and unmount system calls?

996


Explain the unmount system calls?

905


What is the fork() system call?

901