Board index » delphi » piping output to other prog

piping output to other prog

I have a written a program in TP 7 to produce data for an exe file that I
don't have the source for.
The exe file allows this data to be piped to it (just like the more
command).......  (Here comes the question.....)
How do I pass the data to the other program??????
You cannot just write it to the screen!!!
Also I don't want to use the exec commmand and keeping on calling the exe
program as it MUST be fast.
(Basically I want to know where to write my data)
        Thanx

 

Re:piping output to other prog


Quote
Chris Westcott wrote:
> I have a written a program in TP 7 to produce data for an exe file that I
> don't have the source for.
> The exe file allows this data to be piped to it (just like the more
> command).......  (Here comes the question.....)
> How do I pass the data to the other program??????
> You cannot just write it to the screen!!!
> Also I don't want to use the exec commmand and keeping on calling the exe
> program as it MUST be fast.
> (Basically I want to know where to write my data)

As far as piping and redirection goes, you shouldn't have any problems
if you avoid using Crt. Crt hooks Input and Output to routines which
write directly to video memory.

If you must use Crt then you can hook Input and Output to StdIn and
StdOut like so:

  Assign(Input, '');
  Reset(Input);
  Assign(Output, '');
  ReWrite(Output);

Doing this will render Crt's screen-handling routines (WhereX, WhereY,
etc.) useless. In order to undo what the previous snippet did (and
rehook Input and Output to Crt's routines):

  AssignCrt(Input);
  Reset(Input);
  AssignCrt(Output);
  ReWrite(Output);

Avoiding direct screen writes (default when using Crt) should make the
output redirectable/pipable.

AME

Other Threads