Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dos command PIPE

0 views
Skip to first unread message

Marcelino Varas

unread,
Jul 19, 2002, 9:05:55 AM7/19/02
to
Hi:

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.

Mike Williams (TeamB)

unread,
Jul 19, 2002, 9:17:23 AM7/19/02
to

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

Tim Jarvis

unread,
Jul 19, 2002, 9:54:05 AM7/19/02
to
Hi,

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...

0 new messages