diff options
-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; |