I want to do a Delphi program for the DOS command line.
This program has to receive data from the pipe in the form:
c:\dir | program
How can I the data from the pipe to catch ?
Merci.
By writing a console mode application you can run it at a command prompt
(under windows 32, not on a true DOS machine). Data send via a pipe is
just read from standard input. Compile the following program and at the
prompt type: type catch.dpr | catch.exe
program catch;
{$APPTYPE CONSOLE}
var Line : string;
begin
while not eof do begin
Readln(Line);
Writeln('Line : '+Line);
end;
end.
-Mike
Drop a memo on a form and try this. Obviously change as required.
procedure TForm1.FormCreate(Sender: TObject);
var
StdInHandle : cardinal;
InputSize : cardinal;
ActualSize : cardinal;
InputString : String;
begin
StdInHandle := GetStdHandle(STD_INPUT_HANDLE);
Inputsize := SetFilePointer(StdInHandle,0,nil,FILE_END);
if InputSize > 0 then
begin
SetLength(InputString,InputSize);
SetFilePointer(StdInHandle,0,nil,FILE_BEGIN);
ReadFile(StdInHandle,InputString[1],InputSize,ActualSize,nil);
memo1.Lines.Text := InputString;
end;
end;
Pretty Simple really.
Cheers Tim.
"Marcelino Varas" <vr...@mediatechnic.de> wrote in message
news:3d380eb1_2@dnews...