473,396 Members | 2,140 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,396 software developers and data experts.

I get only partial output from a console app. Please help ! :)

Hello, :)

I'm currently writing a frontend for a console application using VB .net.
I'm using the traditional Process creation to launch it and redirect input
and output to my windows application, something like this :

myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.Start()

I then read the console application output and store it into a RichTextBox
using a separate thread :

Sub MonitorPaupOutput()
Dim t As String

frmMain.DefInstance.rtfLog.SelectionStart =
Len(frmMain.DefInstance.rtfLog.Text)
Do
t = sOut.ReadLine()
If t <> "" Then
frmMain.DefInstance.rtfLog.SelectedText = t + vbCrLf
frmMain.DefInstance.rtfLog.ScrollToCaret()
End If

System.Windows.Forms.Application.DoEvents()
Loop
End Sub

If I run the console application in non-interactive mode (i.e. the dos
application only displays some results then quits), everything works fine, I
get all the output. But if I use the console app in interactive mode (like a
standard DOS box, where you have to enter commands), I get only partial
outputs. I have to send a new command to get the end of the previous output,
+ a part of the new.

Let's take an example. I have a frontend for a "cmd.exe" process. I then
send "dir c:\" using the following command :
sIn.Write("dir c:\" & System.Environment.NewLine)

("sIn" is my input streamwriter redirector)

Then I get about half of my directory listing. I send "Dir C:\" again, and I
get the rest of my first "dir" command, and the first half of the second
one... And so on...

It seems that when a prompt in the console app occurs, it blocks the output
until a new command is entered. I'm really stuck here, since I need to be
able to fully control my console app and get all the output I can.

For those interested, and for the kind souls whe would like to help, you'll
find an example here : http://chezpoupoune.free.fr/temp/RedirectConsole.zip.
I'm not the author, but it illustrates well this problem on a cmd.exe front
end.

No need to say that I'll be really grateful to anyone who will try to help.
Thank you very much for your assistance !

Best regards,
F.C
Nov 21 '05 #1
0 1495

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

Similar topics

0
by: Chucker | last post by:
Hi Folks, I got an Auto-Updating Application that is supposed to download all the assemblies needed from a deployment machine when started. Here ist the Code for the Launcher that has to be...
7
by: Ben Bean | last post by:
Yes, the online documentation is EXcellent! So I will be using the php.exe in command line mode VERY SOON! I will readily pick up on ALL of the wonderful ways to parse an input file and send output...
4
by: Michael Maes | last post by:
Hello, I want to add a date (ShortDateString) to a custom template-file (Class). I use: a.. b.. c.. But I can't find anythig on a date (something like: )
2
by: Chris Stiefeling | last post by:
Hi, I am experiencing a strange problem. I am reading and writing xml files via XmlDocument and XmlTextWriter. In the debugger everything works fine but outside the debugger (debug or release)...
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
4
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; When my ASP.NET app is running on IIS, where does the Console.Out.WriteLine("hi there"); output go? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com
1
by: murugavelmsc | last post by:
Hi, In C#, i write a code for partial class as follows, but it throws an error. Please guide me. using System; using System.Collections.Generic; using System.Text; namespace Partial
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
5
by: Jon Skeet [C# MVP] | last post by:
On Sep 9, 9:41 am, raylopez99 <raylope...@yahoo.comwrote: It's tricky in .NET for two reasons: 1) LINQ doesn't have any concept of "remove" 2) List<T>.RemoveAll doesn't pass in the index...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...

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.