Reading standardoutput to a file
-
do something like:
SreamReader r=null;
StreamWriter w=null;//do your stuff => initialize the process+ Info
//now set the SreamReader and writer
w = myProcess.StandartInput
r= myProcess.StandardOutputfrom here it's just a matter of reding the output/r and saving to a specific name/path.
-
I should have been more specific. The part of saving to a specific file name/path is where I am lacking.
try this: use
string str = r.ReadToEnd();
to read the whole content of the StreamReader. Now get the bytes with something like this
byte[] rawbyte= Encoding.Default.GetBytes(str);
now write the bytes to a filestream or use custom bitmap encoding.
FileStream fs = new FileStream("yourfile.here", FileMode.OpenOrCreate);
fs.Write(data, 0, data.Length);hope it helps. I'm not sure if it will work. Read the conversation between me and Luc bellow for details of how ths idea came to me.
-
try this: use
string str = r.ReadToEnd();
to read the whole content of the StreamReader. Now get the bytes with something like this
byte[] rawbyte= Encoding.Default.GetBytes(str);
now write the bytes to a filestream or use custom bitmap encoding.
FileStream fs = new FileStream("yourfile.here", FileMode.OpenOrCreate);
fs.Write(data, 0, data.Length);hope it helps. I'm not sure if it will work. Read the conversation between me and Luc bellow for details of how ths idea came to me.
do you expect binary data to survive like that? I don't know, I never did that on Windows, and everything about stdin/out/err streams seems very text oriented... :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
do you expect binary data to survive like that? I don't know, I never did that on Windows, and everything about stdin/out/err streams seems very text oriented... :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
I don't know exactly. Maybe it works maybe not. Hence the "I hope it helps". :) Actually I did something like it. We have a tracing system in our ptoduction cells and all kind of mobile scanners. One particular kind of those scanners used to change the project comes with off course installers. Between the drivers there's a small utility that gets the "traffic" to and from the scanner on the particular COM port that was asigend to. Documentation 0 nada/rien/kaput/nothing. The program gets the human represntation of the "traffic" meaning text. Something like: "Sending ... to COMx. ... recieved". I had an idea in order to make it easier to use/maintain. But that idea ment sending the bytes to the scanner. The technigue I mentioned => Encoding.Default.GetBytes(...) where ... is the text command worked like a charm. :) Hence my maybe wrong hope of working to a larger set of data/string. PS: I'm not a prog. An IT guy. I should put that in my signature. It's empty anyways. :)
-
I don't know exactly. Maybe it works maybe not. Hence the "I hope it helps". :) Actually I did something like it. We have a tracing system in our ptoduction cells and all kind of mobile scanners. One particular kind of those scanners used to change the project comes with off course installers. Between the drivers there's a small utility that gets the "traffic" to and from the scanner on the particular COM port that was asigend to. Documentation 0 nada/rien/kaput/nothing. The program gets the human represntation of the "traffic" meaning text. Something like: "Sending ... to COMx. ... recieved". I had an idea in order to make it easier to use/maintain. But that idea ment sending the bytes to the scanner. The technigue I mentioned => Encoding.Default.GetBytes(...) where ... is the text command worked like a charm. :) Hence my maybe wrong hope of working to a larger set of data/string. PS: I'm not a prog. An IT guy. I should put that in my signature. It's empty anyways. :)
OK thanks. I hope the OP will tell us the outcome. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
OK thanks. I hope the OP will tell us the outcome. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
sun?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
sun?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
sun?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Prolific encyclopedia fixture proof-reader browser patron addict?
We all depend on the beast below.
-
never mind I got it. It should be son not sun.
Just an irritated, ranting sun of an IT guy