469,608 Members | 2,257 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,608 developers. It's quick & easy.

Starting a process and reading it's output while running

I've been searching for a solution to this problem for a while but
haven't hit upon anything yet.

[b:a09763528e]Using:[/b:a09763528e] MSVC++ .NET 2003
[b:a09763528e]App type:[/b:a09763528e] Windows Forms Application
(Managed C++)
I'm creating a new Process using the Process class which runs a
command line program. However, sometimes the command line program
will pause and wait for user input, but will not send any output to
my program until the process has exited, so I end up in a deadlock -
not able to recognize a request for input (which I could handle by
sending input to the process). I want to know how to retrieve output
from the process as the process is running rather than right after
the process has exited.

I've found a few tutorials around the net, but most of these are for
C#. I think the solution will probably involve multi-threading, but
I'm not quite sure how to do it, not having had enough experience
with multiple threads.

Any help would be appreciated.

Nov 17 '05 #1
2 1519
Anyone have any idea?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 17 '05 #2
"Kyle0654" <Ky******@hotmail-dot-com.no-spam.invalid> wrote in message
Anyone have any idea?

I was going to reply but I wasn't sure what you are asking exactly. :-)

But since you asked a second time ...

Do you know about pipes? Do you know that you can redirect the standard
output device of a ("child") process which you create to a pipe which you
monitor? When the "child" writes to the pipe, you read from it.

However, unless and until the child writes, you get nada.

On first reading your question I wasn't sure if you were asking if there is
some way of coaxing the child into writing before it wants. That would be
magic. :-)

The pipe technique is described here:


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Brian | last post: by
2 posts views Thread by Dave Taylor | last post: by
6 posts views Thread by tatamata | last post: by
8 posts views Thread by cypher543 | last post: by
9 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
2 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.