473,837 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redirecting StandardOutput

I'm having a problem with redirecting the StandardOutput of a process that I
use to run a DOS program in my application. The problem is that I when I
start my process (which I do in a separate thread) I can't read anything
from the stdout before the process actually finishes. If I do something like
this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process
has finished. This is a problem because the program I am running transfers
files to a server and can take a long time to finish, but I'm unable to give
the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things
up until the process has finished? I can't believe there isn't a way to do
this!!

Cheers
Nov 15 '05 #1
15 3135
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I
use to run a DOS program in my application. The problem is that I when I
start my process (which I do in a separate thread) I can't read anything
from the stdout before the process actually finishes. If I do something like
this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process
has finished. This is a problem because the program I am running transfers
files to a server and can take a long time to finish, but I'm unable to give
the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things
up until the process has finished? I can't believe there isn't a way to do
this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I
use to run a DOS program in my application. The problem is that I when I
start my process (which I do in a separate thread) I can't read anything
from the stdout before the process actually finishes. If I do something like
this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process
has finished. This is a problem because the program I am running transfers
files to a server and can take a long time to finish, but I'm unable to give
the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things
up until the process has finished? I can't believe there isn't a way to do
this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #3
Okay, thanks for your response, here is a short test app I wrote that shows
the same behavior as the app I'm trying to write. The process I'm trying to
run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)

using System;

using System.Diagnost ics;

using System.Threadin g;

using System.IO;

namespace ProcessTest

{

class Class1

{

public string m_ProcessArgs;

public string m_ProcessApp;

public string m_Password;

public string m_UserID;

public string m_Address;

public string m_CalcPath;

public Process m_Running;

public StreamReader m_StdOut;

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

Class1 myClass = new Class1();

myClass.m_UserI D = "*******";

myClass.m_Addre ss = "********"; // address of server

myClass.m_CalcP ath = "/*********/"; // path on server

myClass.m_Passw ord = "******";

myClass.PutFile s(@"C:\Data");

// ******* removed for security reasons!!

Console.ReadLin e();

}

public void PutFiles(string FilePath)

{

m_ProcessArgs = "-r -pw " + m_Password + " " + FilePath + " " + m_UserID +
"@" + m_Address + ":" + m_CalcPath;

m_ProcessApp = "pscp.exe";

Console.WriteLi ne("Starting transfer thread");

Thread myThread = new Thread(new ThreadStart(Tra nsferProcess));

myThread.Start( );

Console.WriteLi ne("The transfer thread has been started");

}

private void TransferProcess ()

{

ProcessStartInf o pInfo = new ProcessStartInf o(m_ProcessApp, m_ProcessArgs);

pInfo.UseShellE xecute = false;

pInfo.RedirectS tandardOutput = true;

pInfo.RedirectS tandardError = true;

pInfo.CreateNoW indow = true;

m_Running = new Process();

m_Running.Start Info = pInfo;

Console.WriteLi ne("TransferPro cess is starting process....");

m_Running.Start ();

// This line appears immediately

Console.WriteLi ne("The Process has started");

m_StdOut = m_Running.Stand ardOutput;

// This line doesn't appear until the process has completed

Console.WriteLi ne("This was read from the StdOut: " + m_StdOut.Read() );

m_Running.WaitF orExit();

// This appears immediately after the last line, indicating that the last
line wasn't displayed

// until the end of the process

Console.WriteLi ne("File Transfer Done");

Console.ReadLin e();

}

}

}
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I
start my process (which I do in a separate thread) I can't read anything
from the stdout before the process actually finishes. If I do something like this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process has finished. This is a problem because the program I am running transfers files to a server and can take a long time to finish, but I'm unable to give the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things up until the process has finished? I can't believe there isn't a way to do this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #4
Okay, thanks for your response, here is a short test app I wrote that shows
the same behavior as the app I'm trying to write. The process I'm trying to
run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)

using System;

using System.Diagnost ics;

using System.Threadin g;

using System.IO;

namespace ProcessTest

{

class Class1

{

public string m_ProcessArgs;

public string m_ProcessApp;

public string m_Password;

public string m_UserID;

public string m_Address;

public string m_CalcPath;

public Process m_Running;

public StreamReader m_StdOut;

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

Class1 myClass = new Class1();

myClass.m_UserI D = "*******";

myClass.m_Addre ss = "********"; // address of server

myClass.m_CalcP ath = "/*********/"; // path on server

myClass.m_Passw ord = "******";

myClass.PutFile s(@"C:\Data");

// ******* removed for security reasons!!

Console.ReadLin e();

}

public void PutFiles(string FilePath)

{

m_ProcessArgs = "-r -pw " + m_Password + " " + FilePath + " " + m_UserID +
"@" + m_Address + ":" + m_CalcPath;

m_ProcessApp = "pscp.exe";

Console.WriteLi ne("Starting transfer thread");

Thread myThread = new Thread(new ThreadStart(Tra nsferProcess));

myThread.Start( );

Console.WriteLi ne("The transfer thread has been started");

}

private void TransferProcess ()

{

ProcessStartInf o pInfo = new ProcessStartInf o(m_ProcessApp, m_ProcessArgs);

pInfo.UseShellE xecute = false;

pInfo.RedirectS tandardOutput = true;

pInfo.RedirectS tandardError = true;

pInfo.CreateNoW indow = true;

m_Running = new Process();

m_Running.Start Info = pInfo;

Console.WriteLi ne("TransferPro cess is starting process....");

m_Running.Start ();

// This line appears immediately

Console.WriteLi ne("The Process has started");

m_StdOut = m_Running.Stand ardOutput;

// This line doesn't appear until the process has completed

Console.WriteLi ne("This was read from the StdOut: " + m_StdOut.Read() );

m_Running.WaitF orExit();

// This appears immediately after the last line, indicating that the last
line wasn't displayed

// until the end of the process

Console.WriteLi ne("File Transfer Done");

Console.ReadLin e();

}

}

}
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I
start my process (which I do in a separate thread) I can't read anything
from the stdout before the process actually finishes. If I do something like this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process has finished. This is a problem because the program I am running transfers files to a server and can take a long time to finish, but I'm unable to give the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things up until the process has finished? I can't believe there isn't a way to do this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #5
ewww, hungarian notation...

" Matt Burland" <wjousts@[nospam]hotmail.com> wrote in message
news:uq******** ******@TK2MSFTN GP12.phx.gbl...
Okay, thanks for your response, here is a short test app I wrote that shows the same behavior as the app I'm trying to write. The process I'm trying to run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)

using System;

using System.Diagnost ics;

using System.Threadin g;

using System.IO;

namespace ProcessTest

{

class Class1

{

public string m_ProcessArgs;

public string m_ProcessApp;

public string m_Password;

public string m_UserID;

public string m_Address;

public string m_CalcPath;

public Process m_Running;

public StreamReader m_StdOut;

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

Class1 myClass = new Class1();

myClass.m_UserI D = "*******";

myClass.m_Addre ss = "********"; // address of server

myClass.m_CalcP ath = "/*********/"; // path on server

myClass.m_Passw ord = "******";

myClass.PutFile s(@"C:\Data");

// ******* removed for security reasons!!

Console.ReadLin e();

}

public void PutFiles(string FilePath)

{

m_ProcessArgs = "-r -pw " + m_Password + " " + FilePath + " " + m_UserID +
"@" + m_Address + ":" + m_CalcPath;

m_ProcessApp = "pscp.exe";

Console.WriteLi ne("Starting transfer thread");

Thread myThread = new Thread(new ThreadStart(Tra nsferProcess));

myThread.Start( );

Console.WriteLi ne("The transfer thread has been started");

}

private void TransferProcess ()

{

ProcessStartInf o pInfo = new ProcessStartInf o(m_ProcessApp, m_ProcessArgs);

pInfo.UseShellE xecute = false;

pInfo.RedirectS tandardOutput = true;

pInfo.RedirectS tandardError = true;

pInfo.CreateNoW indow = true;

m_Running = new Process();

m_Running.Start Info = pInfo;

Console.WriteLi ne("TransferPro cess is starting process....");

m_Running.Start ();

// This line appears immediately

Console.WriteLi ne("The Process has started");

m_StdOut = m_Running.Stand ardOutput;

// This line doesn't appear until the process has completed

Console.WriteLi ne("This was read from the StdOut: " + m_StdOut.Read() );

m_Running.WaitF orExit();

// This appears immediately after the last line, indicating that the last
line wasn't displayed

// until the end of the process

Console.WriteLi ne("File Transfer Done");

Console.ReadLin e();

}

}

}
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I start my process (which I do in a separate thread) I can't read anything from the stdout before the process actually finishes. If I do
something
like this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process has finished. This is a problem because the program I am running transfers files to a server and can take a long time to finish, but I'm unable
to
give the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things up until the process has finished? I can't believe there isn't a way
to
do this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 15 '05 #6
ewww, hungarian notation...

" Matt Burland" <wjousts@[nospam]hotmail.com> wrote in message
news:uq******** ******@TK2MSFTN GP12.phx.gbl...
Okay, thanks for your response, here is a short test app I wrote that shows the same behavior as the app I'm trying to write. The process I'm trying to run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)

using System;

using System.Diagnost ics;

using System.Threadin g;

using System.IO;

namespace ProcessTest

{

class Class1

{

public string m_ProcessArgs;

public string m_ProcessApp;

public string m_Password;

public string m_UserID;

public string m_Address;

public string m_CalcPath;

public Process m_Running;

public StreamReader m_StdOut;

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

Class1 myClass = new Class1();

myClass.m_UserI D = "*******";

myClass.m_Addre ss = "********"; // address of server

myClass.m_CalcP ath = "/*********/"; // path on server

myClass.m_Passw ord = "******";

myClass.PutFile s(@"C:\Data");

// ******* removed for security reasons!!

Console.ReadLin e();

}

public void PutFiles(string FilePath)

{

m_ProcessArgs = "-r -pw " + m_Password + " " + FilePath + " " + m_UserID +
"@" + m_Address + ":" + m_CalcPath;

m_ProcessApp = "pscp.exe";

Console.WriteLi ne("Starting transfer thread");

Thread myThread = new Thread(new ThreadStart(Tra nsferProcess));

myThread.Start( );

Console.WriteLi ne("The transfer thread has been started");

}

private void TransferProcess ()

{

ProcessStartInf o pInfo = new ProcessStartInf o(m_ProcessApp, m_ProcessArgs);

pInfo.UseShellE xecute = false;

pInfo.RedirectS tandardOutput = true;

pInfo.RedirectS tandardError = true;

pInfo.CreateNoW indow = true;

m_Running = new Process();

m_Running.Start Info = pInfo;

Console.WriteLi ne("TransferPro cess is starting process....");

m_Running.Start ();

// This line appears immediately

Console.WriteLi ne("The Process has started");

m_StdOut = m_Running.Stand ardOutput;

// This line doesn't appear until the process has completed

Console.WriteLi ne("This was read from the StdOut: " + m_StdOut.Read() );

m_Running.WaitF orExit();

// This appears immediately after the last line, indicating that the last
line wasn't displayed

// until the end of the process

Console.WriteLi ne("File Transfer Done");

Console.ReadLin e();

}

}

}
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I start my process (which I do in a separate thread) I can't read anything from the stdout before the process actually finishes. If I do
something
like this:

Process myProcess = new Process(myStart Info)
// this gets shown straight away
MessageBox.Show ("Process Started");
string s = myProcess.Stand ardOutput.Readl ine();
// this doesn't get shown until the process has finished
MessageBox.Show (s);
myProcess.WaitF orExit();
// this gets shown immediately following the last MessageBox
MessageBox.Show ("Process Finished");

It's clear that I'm not reading anything from the stdout before the process has finished. This is a problem because the program I am running transfers files to a server and can take a long time to finish, but I'm unable
to
give the user any information about what is going on during the transfer.
Can somebody please tell me how to read the stdout without hanging up things up until the process has finished? I can't believe there isn't a way
to
do this!!


I haven't seen this problem - is the standard output (not standard
error) definitely writing whole lines of text? Could you give a short
but complete example? (I remember writing a small "echo" program a
while ago which showed standard input and standard output working, for
example.)

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 15 '05 #7
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
Okay, thanks for your response, here is a short test app I wrote that shows
the same behavior as the app I'm trying to write. The process I'm trying to
run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)


I'm sure an SCP program could be written directly in C#, although I
don't know if there are any SSH utility classes easily available. That
might be your best approach though.

Given that pscp is already using ANSI escape sequences to update single
lines, my guess is that the standard output reader is basically getting
a bit confused. I don't know if pscp is specifically written to notice
that the output is being redirected or not - it could just be that it's
not being flushed until the end if so, or something like that. I can
find out for you if you want.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #8
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
Okay, thanks for your response, here is a short test app I wrote that shows
the same behavior as the app I'm trying to write. The process I'm trying to
run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)


I'm sure an SCP program could be written directly in C#, although I
don't know if there are any SSH utility classes easily available. That
might be your best approach though.

Given that pscp is already using ANSI escape sequences to update single
lines, my guess is that the standard output reader is basically getting
a bit confused. I don't know if pscp is specifically written to notice
that the output is being redirected or not - it could just be that it's
not being flushed until the end if so, or something like that. I can
find out for you if you want.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #9
Thanks for your help. I was starting to think it might be a problem with
pscp itself rather than anything I'm doing. I was also thinking it might be
something to do with how the Process class works. I know from the MSDN docs
that if you redirect the stdout and don't read it, then it can fill the pipe
up and hang the process. I was wondering if there isn't a minimum amount of
data that needs to be written to the pipe before it'll let you read anything
at all from the parent process? Something like the data is only transferred
to the parent process in blocks of some minimum size to avoid slowing both
processes down?
Along the lines of writing an SCP program directly in C#, I know the source
code for Putty is available (it's in C), but I'm not sure I'd know where to
start with it! Maybe if I find myself with a lot of extra time on my hands
I'll try and figure it out. Unfortunately, they don't have it available as a
DLL. If anybody does know of some (free) SSH utility classes that I can use
in my app I'd certainly be grateful. I tried searching online, but didn't
find anything.

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Matt Burland <wjousts@[nospam]hotmail.com> wrote:
Okay, thanks for your response, here is a short test app I wrote that shows the same behavior as the app I'm trying to write. The process I'm trying to run is pscp.exe which can be downloaded from here:
http://www.chiark.greenend.org.uk/~s.../download.html
(NB: If anybody knows a better way to do scp to a unix box, I'd be
interested to here about it.)


I'm sure an SCP program could be written directly in C#, although I
don't know if there are any SSH utility classes easily available. That
might be your best approach though.

Given that pscp is already using ANSI escape sequences to update single
lines, my guess is that the standard output reader is basically getting
a bit confused. I don't know if pscp is specifically written to notice
that the output is being redirected or not - it could just be that it's
not being flushed until the end if so, or something like that. I can
find out for you if you want.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #10

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

Similar topics

3
10416
by: Al Cohen | last post by:
I'll start by warning that I'm a newbie to C# (but I've been programming for 25 years), so I may just be doing something reallyreally dumb. I'm writing a C# wrapper for a command-line application (pscp.exe, a secure file-copy app that's part of the excellent PuTTY SSH package). Getting pscp.exe to run properly was a piece of cake using the System.Diagnostics.Process class. The thing that I can't get to work is the ability to read...
0
345
by: Matt Burland | last post by:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I start my process (which I do in a separate thread) I can't read anything from the stdout before the process actually finishes. If I do something like this: Process myProcess = new Process(myStartInfo) // this gets shown straight away MessageBox.Show("Process Started"); string s =...
5
12840
by: vijaynats | last post by:
Hi I created a windows app to run a dos batch file (which takes around 5mins to complete and generates lots of output messages on the console in the meantime)and i used RedirectStandardOuput to display the output text in a textbox. The problem is that till the batch file has not finished running i don't get to see the output in the text box!!
5
1534
by: Tim | last post by:
Hi I am running a console program through my own VB front end. I am redirecting the StandardOut and StandardInput streams to and from textboxes so that the VB front end acts like a console. My problem is that the console program outputs a message, then a newline, then a prompt character (<message><newline>"> "), but I can only seem to read the StandardOut stream by line. So the prompt character is never shown, since the stream is only read...
6
4175
by: Christophe Helfer | last post by:
hi, I have some problem with redirecting input and output from a process. Situation: I have to use the Cisco Network Registrar (DNS And DHCP server) command line utility as redirecting its input and output so I can interact with this one. This utility is similar to ftp under a win32 console. It proposes its own prompt after launching it. What I want to do is:
5
6204
by: Markus S. | last post by:
Hello, I have a problem with a DOS EXE that is called by a .Net Winforms application. I need to redirect the console output into a textbox, but this should happen in real time, so when new output is written to the redirected StandardOutput-Reader, I want to catch it immediately and add it the my textbox. Now, I have tried everything from threads to invokes, but every time i call the read/readline/readtoend function in the thread, it...
1
1385
by: rubikzube* | last post by:
I am attempting to place a call to make via System.Diagnostics.Process using the sample code below. If I comment out the two problem lines indicated, then the code runs smoothly and make performs quite well. If I leave the two problem lines in, then make "encounters a problem" at the exception line indicated, and pops up a dialog box for sending the error report to microsoft. The technical information in the error report itself is...
3
8477
by: Sudesh | last post by:
Hi, I am a newbie to C# and Im trying to redirect standard input, output and error of a console program written in C (MS VC 6.0) to a textbox on a form. The code for the redirecting looks like this: private System.IO.StreamWriter c_StreamInput = null; private System.IO.StreamReader c_StreamOutput = null; private Thread c_ThreadRead = null; private Process c_Process = null;
3
1606
by: mhmtzdmr | last post by:
Hi, I want to run an application and capture its standard output. But the following code does not generate any output. Can anyone see something wrong? Public Sub RunApp(ByVal myprocess As String, ByVal param As String, ByVal workingDir As String)
0
10882
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10577
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10630
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10275
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7811
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7005
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5851
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4476
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.