日期:2014-05-20 浏览次数:21209 次
view plain
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("Testing in :" + DateTime.Now.ToString());
System.Threading.Thread.Sleep(50);
}
}
static void Main(string[] args)
{
StreamReader sr;
ProcessStartInfo s = new ProcessStartInfo();
s.RedirectStandardInput = true;
s.RedirectStandardOutput = true;
s.UseShellExecute = false;
s.FileName = @"d:\OutputRepeat.exe";
Process p = Process.Start(s);
sr = p.StandardOutput;
while (!sr.EndOfStream)
{
string str = sr.ReadLine();
Console.WriteLine(str);
}
p.WaitForExit();
p.Close();
}
static void Main(string[] args)
{
while (true)
{
Console.Write("Testing in :" + DateTime.Now.ToString());
System.Threading.Thread.Sleep(50);
}
}
static void Main(string[] args)
{
StreamReader sr;
ProcessStartInfo s = new ProcessStartInfo();
s.RedirectStandardInput = true;
s.RedirectStandardOutput = true;
s.UseShellExecute = false;
s.FileName = @"E:\CSharp\OutputRepeat\bin\Release\OutputRepeat.exe";
Process p = Process.Start(s);
sr = p.StandardOutput;
while (!sr.EndOfStream)
{
char[] bs = new char[16];
int i = sr.Read(bs, 0, 16);
foreach (char o in bs)
{
Console.Write(o);
}
}
p.WaitForExit();
p.Close();
}