
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Capturing Standard Output for a Process
|
477
output.Read(info, 0, info.Length);
// Write to the logger.
logger.Write(info, 0, info.Length);
}
}
}
while (!application.HasExited);
}
// Close the process object.
application.Close( );
cmdoutput.log holds information similar to the following output:
Volume in drive C has no label.
Volume Serial Number is DDDD-FFFF
Directory of C:\C#Cookbook2\Code\CSharpRecipes\bin\Debug
08/28/2005 12:25 PM <DIR> .
08/28/2005 12:25 PM <DIR> ..
08/28/2005 12:25 PM 0 cmdoutput.log
08/15/2005 09:46 PM 489,269 CSharpCookbook.zip
08/28/2005 12:24 PM 450,560 CSharpRecipes.exe
08/28/2005 12:24 PM 1,031,680 CSharpRecipes.pdb
07/22/2005 08:28 AM 5,120 CSharpRecipes.vshost.exe
04/12/2005 10:15 PM 432 CSharpRecipes.vshost.xml
05/10/2005 10:14 PM 998 CSharpRecipes.vshost.xsd
03/29/2005 10:27 AM 432 CSharpRecipes.xml
05/10/2005 10:14 PM 998 CSharpRecipes.xsd
03/29/2005 10:27 AM 155 data.txt
04/12/2005 10:15 PM 134 HT.data
12/10/2003 10:11 PM 12,288 REGEX_Test.dll
08/20/2005 09:27 PM 16,384 SampleClassLibrary.dll
08/20/2005 09:27 PM 11,776 SampleClassLibrary.pdb
08/02/2005 08:56 PM 483 se1.object
08/02/2005 08:56 PM 480 se2.object
08/02/2005 08:56 PM 767 se3.object
08/02/2005 08:56 PM 488 se4.object
08/02/2005 08:56 PM 775 se5.object
04/12/2005 10:15 PM 1,369 TEST.DATA
04/12/2005 10:14 ...