[Overview][Constants][Types][Procedures and functions][Variables][Index] Reference for unit 'oldlinux' (#rtl)

CreateShellArgV

Create an array of null-terminated strings

Declaration

Source position: line 0

function CreateShellArgV(

  const prog: String

):ppchar;

function CreateShellArgV(

  const prog: Ansistring

):ppchar;

Description

CreateShellArgV creates an array of 3 PChar pointers that can be used as arguments to ExecVE the first elements in the array will contain /bin/sh, the second will contain -c, and the third will contain prog.

The function returns a pointer to this array, of type PPChar.

Errors

None.

See also

Shell

  

Execute and feed command to system shell

Example

Program ex61;

{ Example program to demonstrate the CreateShellArgV function }

uses oldlinux;

Var
  S: String;
  PP : PPchar;
   I : longint;

begin
  S:='script -a -b -c -d -e fghijk';
  PP:=CreateShellArgV(S);
  I:=0;
  If PP<>Nil then
    While PP[i]<>Nil do
      begin
      Writeln ('Got : "',PP[i],'"');
      Inc(i);
      end;
end.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.