0

I have made an console application (A) which runs independently every day to download files and uses WriteLn('text') to display progress in the console. I then have another GUI application (B) which displays that data in tables, but can also call the first program (A) using ShellExecute.

I need (A) to write a log to a text file as well as display it's progress, so I have two questions:

  • Is there a faster / less tedious way of outputting to textfile AND console other than using AssignFile(F,log.txt) and then find/replacing every WriteLn with:

    WriteLn('my output text'); WriteLn(F,'my output text');

  • Is there a way for my GUI application (B) to display the output from (A) in realtime from the text file, or at least know when (A) is complete. At present I display a message "Please wait for external import to complete and press OK" after which it refreshes the tables.

Thanks

notidaho
  • 588
  • 8
  • 28

1 Answers1

1

You should be able to redirect the output from A to B and then display it in B and log it in B. Its been a long times since I used Delphi but if B is a .net app, there is a nice article here : how to redirect standard output

Kell
  • 3,252
  • 20
  • 19
  • Thanks this is useful though my apps don't use .net and my knowledge pretty much stops at Delphi :p – notidaho Jun 20 '12 at 09:21
  • Delphi seems pretty similar. Maybe this will help: http://delphi.about.com/cs/adptips2001/a/bltip0201_2.htm – Kell Jun 20 '12 at 09:28