Thursday, March 23, 2006

Running command line apps from C#  [Digg.com This!]

Here's a great article on the MSDN blog for how to run a command line app from your C# code. Here it is:

http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx

If you want the quick NON-SYCHRONOUS method, try:

System.Diagnostics.Process.Start(@"c:\myscript.bat");

Thursday, March 16, 2006

Convert char[] to string  [Digg.com This!]

char[] is quite convenient if you're reading file data using StreamReader, but it doesn't offer the same functionality as string does. Here's one way I've found of converting:

char[] charBuf = new char[1024]; // Example char array

string s = ""; // Example empty string

s = new string(charBuf); // Create new string passing charBuf into the constructor