Sir please consider the following....
I would like to copy contents from one file (mart1.c) to another file (mart2.c) using execv() function (using command line arguments).....
The command line argument string is "cp mart1.c mart2.c"
Consider the following code..
int main (int argc, char *argv[])
{
char c[]="cp mart1.c mart2.c";
argv[0]=strtok(c," " );
argv[1]=strtok(0," " );
argv[2]=strtok(0," ");
execv("/bin/cp","cp",argv );
}
The contents are not getting copied when I run this code...Is there mistake in the code..Kindly correct the above code...
Thank you..
I would like to copy contents from one file (mart1.c) to another file (mart2.c) using execv() function (using command line arguments).....
The command line argument string is "cp mart1.c mart2.c"
Consider the following code..
int main (int argc, char *argv[])
{
char c[]="cp mart1.c mart2.c";
argv[0]=strtok(c," " );
argv[1]=strtok(0," " );
argv[2]=strtok(0," ");
execv("/bin/cp","cp",argv );
}
The contents are not getting copied when I run this code...Is there mistake in the code..Kindly correct the above code...
Thank you..
Comment