473,383 Members | 1,891 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,383 software developers and data experts.

redirecting stdout

Im trying to capture the stdout from running a process from within my app.
I've been dinking around using the code straight off the MS site. i can get
"ipconfig / all" (for example) to send back its output, but not (in this
case) "nasm -v" , which displays version information.
whats happening?

slightly modified MS code:
Dim myProcessStartInfo As New ProcessStartInfo("c:\nasm\nasm", "-v")

myProcessStartInfo.UseShellExecute = False

myProcessStartInfo.RedirectStandardOutput = True

myProcess.StartInfo = myProcessStartInfo

myProcessStartInfo.CreateNoWindow = True

myProcess.Start()

Dim myStreamReader As StreamReader = myProcess.StandardOutput

' Read the standard output of the spawned process.

Dim myString As String = myStreamReader.ReadToEnd

txtOutput.Text = myString

thanks,

patrick
Nov 21 '05 #1
3 2933
Hallo Patrick!

"Patrick Porter" <pa*****@ironknee.net> schrieb:
Im trying to capture the stdout from running a process from within my app.
I've been dinking around using the code straight off the MS site. i can
get "ipconfig / all" (for example) to send back its output, but not (in
this case) "nasm -v" , which displays version information.
whats happening?


<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
i adapted your stuff into mine, and i have the same problem....i can run
ipconfig /all and get the output fine, but i cant get the output from
requesting the version info from nasm (c:\nasm\nasm.exe -v). why is it that
i can get some stuff but not all?

also, thanks alot for the code sample. great stuff

patrick
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
Hallo Patrick!

"Patrick Porter" <pa*****@ironknee.net> schrieb:
Im trying to capture the stdout from running a process from within my
app. I've been dinking around using the code straight off the MS site. i
can get "ipconfig / all" (for example) to send back its output, but not
(in this case) "nasm -v" , which displays version information.
whats happening?


<URL:http://dotnet.mvps.org/dotnet/samples/misc/RedirectConsole.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
"Patrick Porter" <pa*****@ironknee.net> wrote in message
news:tC**************@twister.rdc-kc.rr.com...
Im trying to capture the stdout from running a process from within my app.
I've been dinking around using the code straight off the MS site. i can get "ipconfig / all" (for example) to send back its output, but not (in this
case) "nasm -v" , which displays version information.
Since one works and the other doesn't -

Could "nasm" be writing this to stderr, instead of stdout?

HTH,

First guess
whats happening?

slightly modified MS code:
Dim myProcessStartInfo As New ProcessStartInfo("c:\nasm\nasm", "-v")

myProcessStartInfo.UseShellExecute = False

myProcessStartInfo.RedirectStandardOutput = True

myProcess.StartInfo = myProcessStartInfo

myProcessStartInfo.CreateNoWindow = True

myProcess.Start()

Dim myStreamReader As StreamReader = myProcess.StandardOutput

' Read the standard output of the spawned process.

Dim myString As String = myStreamReader.ReadToEnd

txtOutput.Text = myString

thanks,

patrick

Nov 21 '05 #4

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

Similar topics

2
by: Birch | last post by:
I have a python script that uses the print function throughout, and as well uses calls to os.system() to spawn DOS commandline executables. My issue is that I redirect all of the output from this...
3
by: David Douard | last post by:
Hi everybody, let me explain by problem: I am working on an application which consists in a C++ dll (numeric computations) and a Python IHM (Python/Tk), which must run under Linux and win32. My...
3
by: Laszlo Zsolt Nagy | last post by:
Hello, I have this code: s = smtplib.SMTP() s.set_debuglevel(1) s.connect(host=smtp_host) s.set_debuglevel(0) log("Connected, sending e-mail") sys.stdout.flush()
15
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...
9
by: Fuzzyman | last post by:
Hello, I'm trying to redirect standard out in a single namespace. I can replace sys.stdout with a custom object - but that affects all namespaces. There will be code running simultaneously...
8
by: Morpheus | last post by:
I am trying to test a function that outputs text to the standard output, presumably using a cout call. I do not have access to the source, but need to test the output. Is this possible? I can...
1
by: pp4175 | last post by:
Hello Everyone, I am currently working on writing a GUI wrapper for a Menu driven DOS Program. What I was looking on doing is redirecting stdout/stdin to a stream and read/write similar to a...
10
by: SamG | last post by:
How could i make, from inside the program, to have the stdout and stderr to be printed both to a file as well the terminal(as usual).
5
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z | last post by:
I wanna print the log to both the screen and file, so I simulatered a 'tee' class Tee(file): def __init__(self, name, mode): file.__init__(self, name, mode) self.stdout = sys.stdout...
4
by: ElderGeek | last post by:
Hi, all. I am coding in C on Linux, and using an external library provided by others. This library generates a batch of error/warning messages to stdout, which I do not want to see. Before...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...

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.