?? 列表5.1.txt
字號:
【列表5.1】Go button的OnClick事件處理程序。
procedure TfrmExecMain.btnGoClick(Sender: TObject);
const
// program args used by the '1' function
Args : array [0..3] of PChar = ('called', 'by', 'execTest', nil);
var
pargs : PPChar;
penv : PPChar;
fd : integer;
begin
pargs := nil;
penv := nil;
try
if bEnableFlags[rgFunction. Itemtndex].bArgs then
pargs := CreateArgsArray (edCmdLine.Text);
if bEnableFlags[rgFunction. ItemIndex].bEnv then
penv := CreateEnvArray;
case rgFunction. ItemIndex of
0 : execv ('launched', pargs);
1 : execve ('launched'. pargs, penv);
2 : execvp ('launched', pargs);
// execl functions require command line args as params
3 : execl ('launched', Args[0], Args[1], Args[2], nil);
4 : execle ('launched', Args[0], Args[1], Args[2], nil, penv);
5 : execlp ('launched', Args[0], Args[1], Args[2], nil);
6:
begin
// open the file and then call fexecve
fd := Libc.open('launched', 0_RDONLY);
try
if fd = -1 then
begin
ShowMessage ('Error opening file');
exit;
end;
fexecve (fd, pargs, penv);
finally
Libc.__close (fd)
end;
end;
end;
finally
FreePCharArray (pargs);
FreePCharArray (penv);
end;
// values for errno are in Libc.pas
// For example: ENOSYS = 38
ShowMessage (Format ('Error %d launching program'. [errno]));
end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -