473,414 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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.

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.

Nov 17 '05 #1
2 1640
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
news:40**********@127.0.0.1...
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tung Wai Yip | last post by:
I've build the following utility. It works so far but I want to make sure I'm doing the right thing. I am running Python 2.3 on windows 2000. def execute(cmd): """ execute cmd in sub-process,...
0
by: rtm | last post by:
I am interested in running a process with a timeout. Also I'm interested in analyzing the output of this process. Under Unix, the solution is described clearly in the Perl Cookbook "16.10: ...
2
by: Brian | last post by:
I'm running a dos program via System.Diagnostics.Process. The dos program is very picky about filenames and such, and so I want to show the output to the user so they can verify it did what it...
2
by: Dave Taylor | last post by:
I'm writing an app in VB.NET that provides a user-interface to computer simulation model that runs as a console process. I would like to have the console output redirected to my VB.NET program and...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
6
by: tatamata | last post by:
Hello. How can I run some Python script within C# program? Thanks, Zlatko
8
by: cypher543 | last post by:
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But,...
9
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I'm running a process from my application and using streamReader to read it's output. the file i'm running, writes some output to the screen and exceute another program. I'm write the...
2
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I'm trying to run a process and catch it's output and display it in a richTextBox. the process I'm running, runs some other processes, I'm using Thread to run this process, my problem is,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.