Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

Starting a process and reading it's output while running

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kyle0654 - 18 May 2004 23:02 GMT
I've been searching for a solution to this problem for a while but
haven't hit upon anything yet.

Details:
[b:a09763528e]Using:[/b:a09763528e] MSVC++ .NET 2003
[b:a09763528e]App type:[/b:a09763528e] Windows Forms Application
(Managed C++)
[b:a09763528e]Description:[/b:a09763528e]
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.
Kyle0654 - 20 May 2004 20:22 GMT
Anyone have any idea?
William DePalo [MVP VC++] - 21 May 2004 00:00 GMT
> 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:
http://support.microsoft.com/?id=190351

Regards,
Will

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.