summaryrefslogtreecommitdiff
path: root/mystringlistunit.pas
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-05-20 10:19:22 +0200
committerErich Eckner <git@eckner.net>2016-05-20 10:19:22 +0200
commitb9a096c4c5b374715ca093bfb27c0d724c110f45 (patch)
treee5bc567b342ba60965bb84af8be9cb8fdf8a8015 /mystringlistunit.pas
parent31b21da95ad5d3cf4c8cad31977e0c6410e21000 (diff)
downloadunits-b9a096c4c5b374715ca093bfb27c0d724c110f45.tar.xz
loadFromPipe in mystringlistunit.pas neu
Diffstat (limited to 'mystringlistunit.pas')
-rw-r--r--mystringlistunit.pas25
1 files changed, 25 insertions, 0 deletions
diff --git a/mystringlistunit.pas b/mystringlistunit.pas
index 6526dcb..af03f4a 100644
--- a/mystringlistunit.pas
+++ b/mystringlistunit.pas
@@ -20,6 +20,7 @@ type
destructor destroy; override;
procedure loadFromFile(const s: ansiString); override;
procedure loadFromGz(const s: ansiString);
+ procedure loadFromPipe(s: ansiString);
procedure loadFromResource(const s: ansiString);
procedure saveToGz(const s: ansiString);
function readln(out s: string): boolean; inline;
@@ -109,6 +110,30 @@ begin
gibAus(inttostr(count)+' Zeilen eingelesen',1);
end;
+procedure tMyStringlist.loadFromPipe(s: ansiString);
+var
+ len: longint;
+ pt: pointer;
+ buf: ansistring;
+ pr: tProcess;
+begin
+ while max(pos(#13,s),pos(#10,s))>0 do
+ s[max(pos(#13,s),pos(#10,s))]:=' ';
+ pr:=tProcess.create(nil);
+ pr.executable:=erstesArgument(s);
+ while s<>'' do
+ pr.parameters.add(erstesArgument(s));
+ fileunit.loadFromProcess(pr,pt,len);
+ setlength(buf,len);
+ _mov(pt^,buf[1],len);
+ text:=buf;
+ setlength(buf,0);
+ for len:=0 to count-1 do
+ self[len]:=trim(self[len]);
+ line:=0;
+ gibAus(inttostr(count)+' Zeilen eingelesen',1);
+end;
+
procedure tMyStringlist.loadFromResource(const s: ansiString);
var
st: tResourceStream;