Hello guys,
I almost shame to ask, but can you help me with this.
When doing this:
This works fine and the command is executing fine. And the output seems to be correct, this means it shows all directories/files in the current directory and also "-l" properties.Code:char* av[] = { "/bin/ls", "-al" } if(execv(av[0], av) <0) printf("Failed to execute command.\n"); else printf("Yeah! It works!\n");
But when I do the following, the execution keeps failing:
My goal is to call a function for executing a process with options that is determined during runtime. The called process is my other self written program.Code:char* avlong = { "~/Development/Projects/somecmd", "-c 604 -n 1 -f 550" } if(execv(avlong[0], avlong) <0) printf("Failed to execute command.\n"); else printf("Yeah! It works!\n");
I hope you can help me out, thanks.



LinkBack URL
About LinkBacks



CornedBee

