I'm writing a small program in C# that uses an external CYGWIN compiled console application. That application takes 5 seconds to initialize, but after it does, i can send some text and get response almoust instantly. That means I can send new parts of text again add again without restarting app, that programm continuously process its input. I will send lot of text parts to that program, so I decided to redirect it IO so I wont lose 5 sec per text-part of execution time. Here's the part of my code
Expand|Select|Wrap|Line Numbers
- p = new Process();
- ProcessStartInfo psI = new ProcessStartInfo(Directory.GetCurrentDirectory() + "\\tagger\\bin\\analyzer.exe");
- psI.UseShellExecute = false;
- psI.Arguments = " -f en.cfg --outf tagged";
- psI.RedirectStandardInput = true;
- psI.RedirectStandardOutput = true;
- psI.CreateNoWindow = false;
- psI.WorkingDirectory = Directory.GetCurrentDirectory() + "\\tagger\\bin\\";
- p.StartInfo = psI;
- p.Start();
- sw = p.StandardInput;
- sr = p.StandardOutput;
- sw.AutoFlush = true;
From MSDN:
Expand|Select|Wrap|Line Numbers
- // End the input stream to the sort command.
- // When the stream closes, the sort command
- // writes the sorted text lines to the
- // console.
- myStreamWriter.Close();
Thanx in advance!