Hi There,
I have to write a program which takes "ls" command (that displays the list of files in linux) as a command line argument..
I don't have any idea .. how to execute that.. Please Help Me.. Stuck at the following program
Thanks In Advance :)
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <unistd.h>
usingnamespace std;
int main (int argc, char *argv[])
{
int ret;
cout<<"Displaying the list of files using ls as a command line argument\n";
// I don't know what to do here
ret= execl("/usr/bin/argv","list of files,o",NULL);
if (ret == -1 )
cout<<"failed\n";
return 0;
}