Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
GeneralRe: Textbox in datagrid Pin
faizurrahman3-Dec-08 18:14
faizurrahman3-Dec-08 18:14 
QuestionSerial port Pin
hassanasp2-Dec-08 15:05
hassanasp2-Dec-08 15:05 
GeneralRe: Serial port Pin
Luc Pattyn2-Dec-08 21:37
sitebuilderLuc Pattyn2-Dec-08 21:37 
GeneralRe: Serial port Pin
Wes Aday3-Dec-08 4:18
professionalWes Aday3-Dec-08 4:18 
GeneralRe: Serial port Pin
Luc Pattyn3-Dec-08 5:39
sitebuilderLuc Pattyn3-Dec-08 5:39 
QuestionRemote File Read Pin
CodingYoshi2-Dec-08 11:49
CodingYoshi2-Dec-08 11:49 
AnswerRe: Remote File Read Pin
Samer Aburabie2-Dec-08 12:36
Samer Aburabie2-Dec-08 12:36 
GeneralRun CMD, and stream the output, instead of waiting for cmd to be done running. Pin
cscartman2-Dec-08 10:59
cscartman2-Dec-08 10:59 
This code works, but it waits until the program is done running to display anything.
namespace Taynia_Updater
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.ProcessStartInfo sinf = new System.Diagnostics.ProcessStartInfo("cmd", "/c php taynia.php");
            // The following commands are needed to redirect the standard output. This means that it will be redirected to the Process.StandardOutput StreamReader.
            sinf.RedirectStandardOutput = true;
            sinf.UseShellExecute = false;
            // Do not create that ugly black window, please...
            sinf.CreateNoWindow = true;
            // Now we create a process, assign its ProcessStartInfo and start it
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo = sinf;
            p.Start(); // well, we should check the return value here...
            // We can now capture the output into a string...
            string res = p.StandardOutput.ReadToEnd();
            // And do whatever we want with that.
            Console.WriteLine(res);
            Console.ReadLine();
        }
    }
}


This is what i am trying to do (I am not familiar with C#, mostly php)

namespace Taynia_Updater
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Diagnostics.ProcessStartInfo sinf = new System.Diagnostics.ProcessStartInfo("cmd", "/c php taynia.php");
            // The following commands are needed to redirect the standard output. This means that it will be redirected to the Process.StandardOutput StreamReader.
            sinf.RedirectStandardOutput = true;
            sinf.UseShellExecute = false;
            // Do not create that ugly black window, please...
            sinf.CreateNoWindow = true;
            // Now we create a process, assign its ProcessStartInfo and start it
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo = sinf;
            p.Start(); // well, we should check the return value here...
            while (Res = p.StandardOutput.Read())
            {
                Console.WriteLine(res);
            }
            // We can now capture the output into a string...
            /*string res = p.StandardOutput.ReadToEnd();
            // And do whatever we want with that.
            Console.WriteLine(res);
            
             */
            Console.ReadLine();
        }
    }
}


Basically, I just want to be able to stream output of running a command, heck, even running the tree command on the C: drive, i'd like to watch it being done through C#, and not wait for it to be executed, then print it all out at once. Is this even possible?
GeneralRe: Run CMD, and stream the output, instead of waiting for cmd to be done running. Pin
Samer Aburabie2-Dec-08 12:42
Samer Aburabie2-Dec-08 12:42 
GeneralRe: Run CMD, and stream the output, instead of waiting for cmd to be done running. Pin
cscartman2-Dec-08 19:11
cscartman2-Dec-08 19:11 
GeneralRe: Run CMD, and stream the output, instead of waiting for cmd to be done running. Pin
leppie2-Dec-08 20:53
leppie2-Dec-08 20:53 
GeneralRe: Run CMD, and stream the output, instead of waiting for cmd to be done running. Pin
Luc Pattyn2-Dec-08 21:42
sitebuilderLuc Pattyn2-Dec-08 21:42 
QuestionNotSupportedException Pin
Developer6112-Dec-08 10:19
Developer6112-Dec-08 10:19 
AnswerRe: NotSupportedException Pin
Paul Conrad2-Dec-08 10:35
professionalPaul Conrad2-Dec-08 10:35 
AnswerRe: NotSupportedException Pin
Christian Graus2-Dec-08 12:03
protectorChristian Graus2-Dec-08 12:03 
GeneralRe: NotSupportedException Pin
Member 53148902-Dec-08 19:00
Member 53148902-Dec-08 19:00 
GeneralRe: NotSupportedException [modified] Pin
Luc Pattyn2-Dec-08 21:48
sitebuilderLuc Pattyn2-Dec-08 21:48 
GeneralRe: NotSupportedException Pin
Member 53148902-Dec-08 23:35
Member 53148902-Dec-08 23:35 
GeneralRe: NotSupportedException Pin
Luc Pattyn2-Dec-08 23:51
sitebuilderLuc Pattyn2-Dec-08 23:51 
QuestionHow do I change Gridview Cell Color Pin
jesse342-Dec-08 9:55
jesse342-Dec-08 9:55 
AnswerRe: How do I change Gridview Cell Color Pin
Samer Aburabie2-Dec-08 10:20
Samer Aburabie2-Dec-08 10:20 
GeneralRe: How do I change Gridview Cell Color Pin
Paul Conrad2-Dec-08 10:38
professionalPaul Conrad2-Dec-08 10:38 
GeneralRe: How do I change Gridview Cell Color Pin
Samer Aburabie2-Dec-08 11:16
Samer Aburabie2-Dec-08 11:16 
GeneralRe: How do I change Gridview Cell Color Pin
Paul Conrad2-Dec-08 11:19
professionalPaul Conrad2-Dec-08 11:19 
GeneralRe: How do I change Gridview Cell Color Pin
Samer Aburabie2-Dec-08 11:30
Samer Aburabie2-Dec-08 11:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.