diff options
author | Erich Eckner <git@eckner.net> | 2016-05-20 10:19:22 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-05-20 10:19:22 +0200 |
commit | b9a096c4c5b374715ca093bfb27c0d724c110f45 (patch) | |
tree | e5bc567b342ba60965bb84af8be9cb8fdf8a8015 | |
parent | 31b21da95ad5d3cf4c8cad31977e0c6410e21000 (diff) | |
download | units-b9a096c4c5b374715ca093bfb27c0d724c110f45.tar.xz |
loadFromPipe in mystringlistunit.pas neu
-rw-r--r-- | mystringlistunit.pas | 25 |
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; |