Reading output from a process

Hello All,
I am just looking for some advice and tips for a current project that i am working on. My project involves sending key strokes to a windows process, which is easy enough by using SendKey method, but the problem comes when i want to read output from this process so that i can track errors and therefore send the right set of key strokes. When i try to use the RedirectStandardOutput method my windows process just hangs and does nothing, i have also tried reading from a log file that the process sends output to but this has also failed because the applications locks the log file and i am unable to read from it while my windows application is running. The application that i am trying to read from is written in Java but i do not want to change anything in the Java code as this application is updated quite regularly so it would just overwrite my changes. Any advice given will be much appreciated.

Thanks.

[967 byte] By [C#Shooter] at [2007-12-16]
# 1
You have to be careful using RedirectStandardOutput as a deadlock can occur when it is used in conjuction with WaitForExit.

Instead, have a look at the BeginOutputReadLine method, which begins async reads on the StandardOutput stream.

DavidM.Kean at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...