using (Stream stdin = Console.OpenStandardInput())
{
using (Stream stdout = Console.OpenStandardOutput())
{
byte[] buffer = new byte[2048];
int bytes;
while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0)
{
stdout.Write(buffer, 0, bytes);
}
}
}
This code is a basic echo from the stdin to stdout, and it works when I write directly into the console. But when I try to write to the stdin using another program, in this case an AIR game using ActionScript 3, it isn't working.
I've launched the C# application using AS3's NativeProcess. It let's me start a process and access it's standard input/output. Reading from the stdout works fine, but writing to the stdin does nothing.
This is the AS3 code that writes to the stdin:
I got no clue why this isn't working. I've tried several different reading methods on the C# application but nothing captures the data I send via the stdin.
I'd appreciate any help as to why this isn't working. Thanks!