[so] parametrii execv

Catalin Iacob iacobcatalin at gmail.com
Wed Oct 31 22:44:28 EET 2007


On Wednesday 31 October 2007 22:38:04 Maria Nadejde wrote:
> Am si eu o intrebare:
>
> de ce nu merge execv cand ii dau urmatorii parametrii:
>
> char *args[3];
> args[0]="mkdir";
> 	args[1]="hipo";
> 	args[2]=NULL;
> fork() case 0:
> execve_rv=execv(args[0],args);

execv cauta mkdir doar in directorul curent unde nu-l gaseste deci esueaza. 

> dar merge:
> execlp_rv=execlp(args[0],args[0],args[1],NULL);
>

Merge fiindca are p la sfarsit; variantele de exec cu p cauta si in path 
executabilul.

=> execvp e ceea ce cauti in loc de execv

Catalin


More information about the so mailing list