|
I am trying to call a program that comverts BMP to PPM formats. The exe to do so dumps the binary contents of the conversion to the console unless redirected as such
bmptoppm.exe input.bmp >output.ppm
I am attempting to call this exe from inside a different windows forms application and save the ouput to output.ppm. I am doing so using the process class
<br />
Process myProcess = new Process();<br />
<br />
myProcess.StartInfo.UseShellExecute = false;<br />
myProcess.StartInfo.Arguments = "C:\\input.bmp";<br />
myProcess.StartInfo.FileName = "C:\\bmptoppm.exe";<br />
myProcess.StartInfo.CreateNoWindow = false;<br />
myProcess.StartInfo.RedirectStandardOutput = true;<br />
myProcess.StartInfo.RedirectStandardError = true;<br />
myProcess.Start();<br />
I am getting hung on on how exactly I can do the writing of the standardoutput to a file. Could someone point me in the right direction please?
|
|
|
|
|
do something like:
SreamReader r=null;
StreamWriter w=null;
w = myProcess.StandartInput
r= myProcess.StandardOutput
from 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.
|
|
|
|
|
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...
|
|
|
|
|
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.
|
|
|
|
|
Me too.
Just an irritated, ranting sun of an IT guy
|
|
|
|
|
|
did i spelled something wrong?
Just an irritated, ranting sun of an IT guy
|
|
|
|
|
never mind I got it. It should be son not sun.
Just an irritated, ranting sun of an IT guy
|
|
|
|
|
Wow. Responses to the dome. I will attempt it and get back.
|
|
|
|
|
I have installed this from a dozen different locations and yet when I open up VS 2010 and click file, new, website there is lots of ASP.Nets there but no MVC or MVC2. Anyone know why?
Thanks
Darrall
|
|
|
|
|
Did you use the Web Installer? I've used that on a few different machines and it's worked fine for me. Sorry, that's the most irritating answer when something doesn't work.
|
|
|
|
|
Yes...used 3 or 4 different ones The stupid thing is it says it's installed - it just isn't anywhere to be seen when you open it up. Figure something out I guess. Thanks for answering.
|
|
|
|
|
Open VS2010 ->File->New->New Project->select Language ->inside language select Web->select mvc2 ok;
if this helped you please vote me.
|
|
|
|
|
Please help me on this.
Inserting an image file to the SQL Server is not an issue for me. My problem is, I want to update the databse having an image datatype with a NULL value.
Thanks
|
|
|
|
|
The database general forum would have been a better place to ask, but
alter table [yourTable] alter column [yourColumn] image NULL
|
|
|
|
|
Hello,
How can I write a embedded resource (*.exe) in a folder?
Like this:
System.Properties.Resources.Test.exe //write in folder @(C://users/) with the name "Test.exe".
I'm using Visual Studio 2008 C#
and I'm a beginner.
Thank You very much
Boris
|
|
|
|
|
Hi,
There's a nice explanation here[^].
I are Troll
|
|
|
|
|
Thank You!
My application work now!
Boris
|
|
|
|
|
Hi,
I develop a csharp smart device application.I want now to connect to my romote databse .mdf(synchronous mode:connected mode).So i want to migrate my application to a real time application.When I try to add my romote database as an exiting item,the system doesn't let me to do that.
Also when i try to change my string connection from:
string wCS = @"Data Source =\Storage Card\ModeDifféré\BaseGmaoLocale.sdf;";
to:
string wCS = @"Data Source =\Storage Card\BaseGmaoDOTNET;";
when running,it tells me that there is an error in the database path
what is the problem??
thanks for u help
|
|
|
|
|
You asked this question below. Please just post there and see if you can get clarifications instead of starting a new thread.
If I have accidentally said something witty, smart, or correct, it is purely by mistake and I apologize for it.
|
|
|
|
|
Hello,
As a part of my application, i draw polygons.
My application is related in GIS.
In general the cursor mode is "cmnone" and we can also change it to zoom, cmselection in the properties.
In the properties-cursor mode, there are only 5 modes to choose.
But if i want to change the cursor mode to some other like '+' sign when ever i enable the drawing polygon, how should i do it???
|
|
|
|
|
Hi,
You're referring to the mouse-cursor? What kind of application are you in, WinForms[^], WPF, ASP.NET, or something more arcane?
I are Troll
|
|
|
|