ex9.pp 426 B

12345678910111213141516171819202122
  1. Program Example9;
  2. { Program to demonstrate the Execvp function. }
  3. Uses linux, strings;
  4. Const Arg0 : PChar = 'ls';
  5. Arg1 : Pchar = '-l';
  6. Var PP : PPchar;
  7. begin
  8. GetMem (PP,3*SizeOf(Pchar));
  9. PP[0]:=Arg0;
  10. PP[1]:=Arg1;
  11. PP[3]:=Nil;
  12. { Execute 'ls -l', with current environment. }
  13. { 'ls' is looked for in PATH environment variable.}
  14. { Envp is defined in the system unit. }
  15. Execvp ('ls',pp,envp);
  16. end.