Hello,
I have a C# app that spawns several processes each containing a console
app written by another developer in C++. The console app was written
first to be just like a console app: it starts, you type a command it
does a command and returns a message. I thought I would be able to
consume it in my C# app by using the Process.StandardInput in
conjunction with the Process.StartInfo.RedirectStandardOutput. The
output works fine and I can receive messages. But for some reason the
C++ app doesn't seem to be getting the messages. Here is what my side
of the code started out as:
private void StreamInput(string text)
{
encoderProcess.StandardInput.WriteLine(text);
encoderProcess.StandardInput.Flush();
}
But it wasn't getting the message. I read on another post that the C++
app would be expecting ASCII instead of the .NET's default Unicode so I
rewrote it like so:
private void StreamInput(string text)
{
byte[] byteData = Encoding.ASCII.GetBytes(text);
char[] charData = Encoding.ASCII.GetChars(byteData);
encoderProcess.StandardInput.WriteLine(charData);
encoderProcess.StandardInput.Flush();
}
But it *still* doesn't seem to be getting the message. Is there
something obvious that I'm not doing correctly or does the other
developer need to dig in to his side? INO, what does it take for both
side to play well with each other?
TIA,
nautonnier