Delphi-PRAXiS
Seite 3 von 3     123   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Text an ein Console Programm Senden (https://www.delphipraxis.net/114319-text-ein-console-programm-senden.html)

chaosben 22. Aug 2009 22:08

Re: Text an ein Console Programm Senden
 
Hmmm .. ein guter Einwurf.
Ich hab die Unit mal angepasst. Jetzt funktioniert es auch mit D2009.

Teekeks 23. Aug 2009 05:56

Re: Text an ein Console Programm Senden
 
Hi!
Wenn du TProcess benutzt (oder irgenteine abart davon) dann kannst du mit der folgenden kleinen Procedure alles an deine Konsole senden was du möchtest. Auch ganze befehle mit einem mal!
Delphi-Quellcode:
procedure SendCommand(cmd: string);
begin
  cmd:=cmd+#10;
  {dein Process}.Input.Write(cmd[1],Length(cmd));
end;
Wenn du den Output auch brauchs dann geht das damit:
Delphi-Quellcode:
function GetProcessOutput: string;
var AStringList: TStringList;
begin
   AStringList:=TStringList.Create;
   try
      AStringList.LoadFromStream({deim Process}.Output);
      Result:=AStringList.Strings[0];
   except
      writeln('EXCEPTION reading output');result:='';
   end;
   AStringList.Free;
end;
Gruß Teekeks


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:25 Uhr.
Seite 3 von 3     123   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz