Thursday, 4 December 2014

program to print long listing of files using execlp


#include"myHeader.h"
main(int argc,char **argv)
{
execlp("ls","ls","-li","-t",NULL);
}
output:
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out
total 2884
4325487 -rwxr-xr-x 1 madan madan    8560 Apr  4 07:17 a.out
4325511 -rw-r--r-- 1 madan madan      87 Apr  4 07:17 ex11.c
4325510 -rw-r--r-- 1 madan madan     319 Apr  4 07:17 ex10.c
4325509 -rw-r--r-- 1 madan madan     131 Apr  4 07:14 ex9.c
4325508 -rw-r--r-- 1 madan madan     234 Apr  4 07:10 ex8.c
4325507 -rw-r--r-- 1 madan madan     453 Apr  4 07:04 ex7.c
4325505 -rw-r--r-- 1 madan madan     306 Apr  4 07:02 ex6.c
4325493 -rw-r--r-- 1 madan madan     281 Apr  4 06:56 ex5.c
4325506 -rw-r--r-- 1 madan madan     613 Apr  4 06:55 myHeader.h
4325496 -rw-r--r-- 1 madan madan     230 Apr  4 06:51 ex4.c
4325495 -rw-r--r-- 1 madan madan     104 Apr  4 06:49 ex3.c
4325494 -rw-r--r-- 1 madan madan     322 Apr  4 06:49 ex2.c
4325488 -rw-r--r-- 1 madan madan 2886512 Apr  4 06:44 myHeader.h.gch
4325490 -rw-r--r-- 1 madan madan      48 Apr  4 06:43 madan
4325491 -rw-r--r-- 1 madan madan     277 Apr  4 06:43 ex1.c