can anyone help me with my code. i am trying to make the exec read input from the keyboard but i have no idea how to start. the code works if the path and the file names are already there..here is what i have done so far with the child process code. the code runs under linux or unix only.
#include <stdio.h>
main()
{
int PorC, pid, status;
char path,argum;
if ((PorC=fork())==0)
{
printf ("Enter the path name ");
scanf ("%c", &path);
execl ("&path", "&path", "one", 0);
//originally the code without input from keyboard is commented below and it works well
// execl ("main_prog","main_prog","one",0);
//the file main_prog is in the same dir so i use the same file name
fprintf(stderr, "exec() call failed\n");
exit(-1);
}
else
{
printf("this is parent\n");
pid = wait(&status);
}
}