mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 19:46:02 +02:00
* Added some example program for TProcess
git-svn-id: trunk@32891 -
This commit is contained in:
parent
ef9504ffd7
commit
622ffb9a65
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -2575,6 +2575,11 @@ packages/fcl-passrc/tests/testpassrc.lpr svneol=native#text/plain
|
||||
packages/fcl-process/Makefile svneol=native#text/plain
|
||||
packages/fcl-process/Makefile.fpc svneol=native#text/plain
|
||||
packages/fcl-process/Makefile.fpc.fpcmake svneol=native#text/plain
|
||||
packages/fcl-process/examples/demoproject.ico -text
|
||||
packages/fcl-process/examples/demoproject.lpi svneol=native#text/plain
|
||||
packages/fcl-process/examples/demoproject.pp svneol=native#text/plain
|
||||
packages/fcl-process/examples/demoproject.res -text
|
||||
packages/fcl-process/examples/echoparams.pp svneol=native#text/plain
|
||||
packages/fcl-process/fpmake.pp svneol=native#text/plain
|
||||
packages/fcl-process/src/amicommon/pipes.inc svneol=native#text/plain
|
||||
packages/fcl-process/src/amicommon/process.inc svneol=native#text/plain
|
||||
|
BIN
packages/fcl-process/examples/demoproject.ico
Normal file
BIN
packages/fcl-process/examples/demoproject.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
73
packages/fcl-process/examples/demoproject.lpi
Normal file
73
packages/fcl-process/examples/demoproject.lpi
Normal file
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<SaveOnlyProjectUnits Value="True"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="demoproject"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
</i18n>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="demoproject.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="../src/process.pp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="../src;../src/unix;$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="../src"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<UseAnsiStrings Value="False"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
33
packages/fcl-process/examples/demoproject.pp
Normal file
33
packages/fcl-process/examples/demoproject.pp
Normal file
@ -0,0 +1,33 @@
|
||||
program demoproject;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
sysutils, process;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
Var
|
||||
I : integer;
|
||||
|
||||
begin
|
||||
if ParamCount<>0 then
|
||||
begin
|
||||
Writeln('This is executable: "',ParamStr(0),'"');
|
||||
Writeln('Got parameters:');
|
||||
For I:=1 to 10 do
|
||||
Writeln('"',ParamStr(I),'"');
|
||||
end
|
||||
else
|
||||
With TProcess.Create(Nil) do
|
||||
try
|
||||
Executable:=ParamStr(0);
|
||||
Writeln(Format('Starting executable: "%s"',[Executable]));
|
||||
For I:=1 to 10 do
|
||||
Parameters.Add('Parameter '+IntToStr(I));
|
||||
Execute;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end.
|
||||
|
BIN
packages/fcl-process/examples/demoproject.res
Normal file
BIN
packages/fcl-process/examples/demoproject.res
Normal file
Binary file not shown.
9
packages/fcl-process/examples/echoparams.pp
Normal file
9
packages/fcl-process/examples/echoparams.pp
Normal file
@ -0,0 +1,9 @@
|
||||
program echoparams;
|
||||
|
||||
var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
For I:=0 to ParamCount do
|
||||
Writeln(I:2,' : "',Paramstr(i),'"');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user